ci/lava: Cancel the job if the script is interrupted

During development, we may want to test lava_job_submitter.py locally,
sometimes one can find what one is been looking for before the LAV job
is done. Let's respond to SIGINT signal and cancel the LAVA job, as we
can't follow what is happening anymore via script.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15938>
This commit is contained in:
Guilherme Gallo 2022-04-08 11:52:50 -03:00 committed by Marge Bot
parent c64e3d92df
commit 5fc333d0b6
1 changed files with 4 additions and 0 deletions

View File

@ -395,6 +395,10 @@ def retriable_follow_job(proxy, job_definition):
except MesaCIException as mesa_exception:
print_log(mesa_exception)
job.cancel()
except KeyboardInterrupt as e:
print_log("LAVA job submitter was interrupted. Cancelling the job.")
job.cancel()
raise e
finally:
print_log(f"Finished executing LAVA job in the attempt #{attempt_no}")