Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ansible_runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, config, cancel_callback=None, remove_partials=True, event_han
self.status_handler = status_handler
self.canceled = False
self.timed_out = False
self.idle_timed_out = False
self.errored = False
self.status = "unstarted"
self.rc = None
Expand Down Expand Up @@ -337,7 +338,7 @@ def _decode(x):
if self.config.idle_timeout and (time.time() - self.last_stdout_update) > self.config.idle_timeout:
self.kill_container()
Runner.handle_termination(child.pid, is_cancel=False)
self.timed_out = True
self.idle_timed_out = True
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need a default like timed_out has on line 37. Otherwise if we don't hit this case, we'll crash when we check the variable below.


stdout_handle.close()
stderr_handle.close()
Expand All @@ -350,6 +351,8 @@ def _decode(x):
self.status_callback('successful')
elif self.timed_out:
self.status_callback('timeout')
elif self.idle_timed_out:
self.status_callback('idle_timeout')
else:
self.status_callback('failed')

Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_run_command_idle_timeout(rc):
rc.idle_timeout = 0.0000001
runner = Runner(config=rc)
status, exitcode = runner.run()
assert status == 'timeout'
assert status == 'idle_timeout'
assert exitcode == 254


Expand Down