diff --git a/tes/apiendpoints.py b/tes/apiendpoints.py index ccc49e1c6939e95be3b08ed923510227635b9fce..775051c46eeafc78d78c3aceab64a5b0a8a223ae 100644 --- a/tes/apiendpoints.py +++ b/tes/apiendpoints.py @@ -10,6 +10,7 @@ import flask_restful from . import api, app from .sshwrapper import Ssh, SshAgentException, SftpPermissionException, SftpException, SshCtrlException, SshExecException from .tunnelstat import SSHSession +import subprocess class AppParamsException(Exception): pass @@ -228,8 +229,10 @@ def wrap_execute(sess, host, user, cmd, bastion=None,stdin=None, sshport="22", b return apiabort(401,message="".format(host)) # This exception is raised if the remove command had a non-zero return code except SshExecException as e: - return apiabort(400,message="{}".format(e)) + return apiabort(400, message="{}".format(e)) # Any other exceptions. This should never be reached. + except subprocess.TimedoutExpired as e: + return apiabort(599, message="{}".format(e)) except Exception as e: import traceback logger.error('JobStat.get: Exception {}'.format(e)) @@ -477,7 +480,7 @@ class AppLaunch(Resource): logger.error(e) logger.error(traceback.format_exc()) #flask_restful.abort(500,message="AppUrl failed in some unexpected way") - return apiabort(500,message="AppUrl failed in some unexpected way") + return apiabort(500,message="AppLaunc failed in some unexpected way") logger.debug('application launched, returning') return None, 200 diff --git a/tes/sshwrapper/__init__.py b/tes/sshwrapper/__init__.py index 9e5e82346ace85830a026a67aeb309fd687058bd..c43b0c6df8a9109f12c570e425588aadf8584f84 100644 --- a/tes/sshwrapper/__init__.py +++ b/tes/sshwrapper/__init__.py @@ -337,7 +337,8 @@ class Ssh: except subprocess.TimeoutExpired as e: logger.debug('cmd timed out') 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: logger.error(stderr) sess.kill()