Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
strudel2_backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hpc-team
strudel2_backend
Commits
d74b1790
Commit
d74b1790
authored
4 years ago
by
Chris Hines
Browse files
Options
Downloads
Patches
Plain Diff
use HTTP status 599 to signify an SSH timeout
parent
0112192f
No related branches found
No related tags found
3 merge requests
!77
Revert "disable agressive kill and restart"
,
!64
Test
,
!62
Dev
Pipeline
#15921
passed
4 years ago
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tes/apiendpoints.py
+5
-2
5 additions, 2 deletions
tes/apiendpoints.py
tes/sshwrapper/__init__.py
+2
-1
2 additions, 1 deletion
tes/sshwrapper/__init__.py
with
7 additions
and
3 deletions
tes/apiendpoints.py
+
5
−
2
View file @
d74b1790
...
@@ -10,6 +10,7 @@ import flask_restful
...
@@ -10,6 +10,7 @@ import flask_restful
from
.
import
api
,
app
from
.
import
api
,
app
from
.sshwrapper
import
Ssh
,
SshAgentException
,
SftpPermissionException
,
SftpException
,
SshCtrlException
,
SshExecException
from
.sshwrapper
import
Ssh
,
SshAgentException
,
SftpPermissionException
,
SftpException
,
SshCtrlException
,
SshExecException
from
.tunnelstat
import
SSHSession
from
.tunnelstat
import
SSHSession
import
subprocess
class
AppParamsException
(
Exception
):
class
AppParamsException
(
Exception
):
pass
pass
...
@@ -228,8 +229,10 @@ def wrap_execute(sess, host, user, cmd, bastion=None,stdin=None, sshport="22", b
...
@@ -228,8 +229,10 @@ def wrap_execute(sess, host, user, cmd, bastion=None,stdin=None, sshport="22", b
return
apiabort
(
401
,
message
=
""
.
format
(
host
))
return
apiabort
(
401
,
message
=
""
.
format
(
host
))
# This exception is raised if the remove command had a non-zero return code
# This exception is raised if the remove command had a non-zero return code
except
SshExecException
as
e
:
except
SshExecException
as
e
:
return
apiabort
(
400
,
message
=
"
{}
"
.
format
(
e
))
return
apiabort
(
400
,
message
=
"
{}
"
.
format
(
e
))
# Any other exceptions. This should never be reached.
# Any other exceptions. This should never be reached.
except
subprocess
.
TimedoutExpired
as
e
:
return
apiabort
(
599
,
message
=
"
{}
"
.
format
(
e
))
except
Exception
as
e
:
except
Exception
as
e
:
import
traceback
import
traceback
logger
.
error
(
'
JobStat.get: Exception {}
'
.
format
(
e
))
logger
.
error
(
'
JobStat.get: Exception {}
'
.
format
(
e
))
...
@@ -477,7 +480,7 @@ class AppLaunch(Resource):
...
@@ -477,7 +480,7 @@ class AppLaunch(Resource):
logger
.
error
(
e
)
logger
.
error
(
e
)
logger
.
error
(
traceback
.
format_exc
())
logger
.
error
(
traceback
.
format_exc
())
#flask_restful.abort(500,message="AppUrl failed in some unexpected way")
#flask_restful.abort(500,message="AppUrl failed in some unexpected way")
return
apiabort
(
500
,
message
=
"
App
Url
failed in some unexpected way
"
)
return
apiabort
(
500
,
message
=
"
App
Launc
failed in some unexpected way
"
)
logger
.
debug
(
'
application launched, returning
'
)
logger
.
debug
(
'
application launched, returning
'
)
return
None
,
200
return
None
,
200
...
...
This diff is collapsed.
Click to expand it.
tes/sshwrapper/__init__.py
+
2
−
1
View file @
d74b1790
...
@@ -337,7 +337,8 @@ class Ssh:
...
@@ -337,7 +337,8 @@ class Ssh:
except
subprocess
.
TimeoutExpired
as
e
:
except
subprocess
.
TimeoutExpired
as
e
:
logger
.
debug
(
'
cmd timed out
'
)
logger
.
debug
(
'
cmd timed out
'
)
logger
.
debug
(
"
exception execute
"
)
logger
.
debug
(
"
exception execute
"
)
raise
SshExecException
(
message
=
"
A program timed out on the backend server
"
)
raise
e
#raise SshExecException(message="A program timed out on the backend server")
if
exec_p
.
returncode
==
255
:
if
exec_p
.
returncode
==
255
:
logger
.
error
(
stderr
)
logger
.
error
(
stderr
)
sess
.
kill
()
sess
.
kill
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment