Skip to content

Commit

Permalink
Fix nonblocking related tracebacks, add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Feb 9, 2023
1 parent 064eae4 commit 5f27f77
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions awx/main/tasks/receptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ def run_until_complete(node, timing_data=None, **kwargs):
stdout = ''

try:

resultfile = receptor_ctl.get_work_results(unit_id)

while run_timing < 20.0:
Expand All @@ -206,7 +205,6 @@ def run_until_complete(node, timing_data=None, **kwargs):
stdout = str(stdout, encoding='utf-8')

finally:

if settings.RECEPTOR_RELEASE_WORK:
res = receptor_ctl.simple_command(f"work release {unit_id}")
if res != {'released': unit_id}:
Expand Down Expand Up @@ -433,7 +431,6 @@ def _run_internal(self, receptor_ctl):
# massive, only ask for last 1000 bytes
startpos = max(stdout_size - 1000, 0)
resultsock, resultfile = receptor_ctl.get_work_results(self.unit_id, startpos=startpos, return_socket=True, return_sockfile=True)
resultsock.setblocking(False) # this makes resultfile reads non blocking
lines = resultfile.readlines()
receptor_output = b"".join(lines).decode()
if receptor_output:
Expand All @@ -443,6 +440,7 @@ def _run_internal(self, receptor_ctl):
else:
logger.warning(f'No result details or output from {self.task.instance.log_format}, status:\n{state_name}')
except Exception:
logger.exception(f'Work results error from job id={self.task.instance.id} work_unit={self.task.instance.work_unit_id}')
raise RuntimeError(detail)

return res
Expand Down

0 comments on commit 5f27f77

Please sign in to comment.