timeout give extra info (#83206)

the new field shows the python code in execution when it timed out, 99% of the time it will be on a selector waiting for output from ssh to remote.
pull/83364/head
Brian Coca 6 months ago committed by GitHub
parent e07b4edc54
commit c77ed376c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
minor_changes:
- task timeout now returns timedout key with frame/code that was in execution when the timeout is triggered.

@ -42,11 +42,13 @@ __all__ = ['TaskExecutor']
class TaskTimeoutError(BaseException):
pass
def __init__(self, message="", frame=None):
self.frame = str(frame)
super(TaskTimeoutError, self).__init__(message)
def task_timeout(signum, frame):
raise TaskTimeoutError
raise TaskTimeoutError(frame=frame)
def remove_omit(task_args, omit_token):
@ -640,7 +642,7 @@ class TaskExecutor:
return dict(unreachable=True, msg=to_text(e))
except TaskTimeoutError as e:
msg = 'The %s action failed to execute in the expected time frame (%d) and was terminated' % (self._task.action, self._task.timeout)
return dict(failed=True, msg=msg)
return dict(failed=True, msg=msg, timedout=e.frame)
finally:
if self._task.timeout:
signal.alarm(0)

@ -10,3 +10,4 @@
that:
- time is failed
- '"The shell action failed to execute in the expected time frame" in time["msg"]'
- '"timedout" in time'

Loading…
Cancel
Save