Skip to content

Commit

Permalink
differentiate timeout vs idle timeout
Browse files Browse the repository at this point in the history
currently idle timeout and timeout result in the same status call back this result in the AWX not being able to parse the differences between the two failure condition and make it confusing to debg

Co-Authored-By: Gabriel Muniz <[email protected]>
  • Loading branch information
TheRealHaoLiu and Gabriel Muniz committed Feb 28, 2023
1 parent a4a981d commit e5cf8da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ansible_runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,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

stdout_handle.close()
stderr_handle.close()
Expand All @@ -350,6 +350,8 @@ def _decode(x):
self.status_callback('successful')
elif self.timed_out:
self.status_callback('timeout')
elif self.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

0 comments on commit e5cf8da

Please sign in to comment.