Skip to content

is_lwd_hit: return False for a non-found task

Tino Calancha requested to merge calancha/upt:is_lwd_hit_not_found_task into main

RestraintJob::get_task_by_id returns None when the task is not found.

Prevent from calling task.hit_localwatchdog if task is None.

We have an example of the above in the description of #102 (closed)

We observe the following backtrace in the logs:

unexpected error in processEnded
Traceback (most recent call last):
  File "/builds/3719931730/software/venv/lib64/python3.11/site-packages/twisted/internet/process.py", line 935, in maybeCallProcessEnded
    self.reapProcess()
  File "/builds/3719931730/software/venv/lib64/python3.11/site-packages/twisted/internet/process.py", line 308, in reapProcess
    self.processEnded(status)
  File "/builds/3719931730/software/venv/lib64/python3.11/site-packages/twisted/internet/_baseprocess.py", line 55, in processEnded
    self.maybeCallProcessEnded()
  File "/builds/3719931730/software/venv/lib64/python3.11/site-packages/twisted/internet/process.py", line 937, in maybeCallProcessEnded
    _BaseProcess.maybeCallProcessEnded(self)
--- <exception caught here> ---
  File "/builds/3719931730/software/venv/lib64/python3.11/site-packages/twisted/internet/_baseprocess.py", line 66, in maybeCallProcessEnded
    proto.processEnded(Failure(reason))
  File "/builds/3719931730/software/venv/lib64/python3.11/site-packages/restraint_wrap/restraint_protocol.py", line 512, in processEnded
    self.cleanup_handler()
  File "/builds/3719931730/software/venv/lib64/python3.11/site-packages/restraint_wrap/restraint_protocol.py", line 455, in cleanup_handler
    self.evaluate_host_abort(host)
  File "/builds/3719931730/software/venv/lib64/python3.11/site-packages/restraint_wrap/restraint_protocol.py", line 878, in evaluate_host_abort
    task_result.lwd_hit = self.is_lwd_hit(task_result.recipe_id, task_result.task_id)
  File "/builds/3719931730/software/venv/lib64/python3.11/site-packages/restraint_wrap/restraint_protocol.py", line 713, in is_lwd_hit
    return task.hit_localwatchdog
builtins.AttributeError: 'NoneType' object has no attribute 'hit_localwatchdog'
Edited by Tino Calancha

Merge request reports