Kevin Weiler
10/05/2021, 1:56 PMdef nomad_batch_node_cancel_handler(task: Task, old_state: State, new_state: State):
if (new_state == Cancelled) & (old_state == Running):
<http://_LOGGER.info|_LOGGER.info>(f"killing job {nomad_job_name}")
Nomad().stop_job(job_id=nomad_job_name)
It gets nomad_job_name
from an enclosing function (it’s a closure).
When I click the “cancel” button in the UI - I don’t think this handler is getting executed - my log message isn’t there, and the task is not killed. Is there something wrong with how I’m testing for state change? It seems to me that the task is in a Running
state when I click cancel, and the UI seems to think it goes to a Cancelled
state thereafter.Kevin Kho
Kevin Weiler
10/05/2021, 1:59 PMKevin Kho
Kevin Weiler
10/05/2021, 2:02 PMKevin Kho
Kevin Weiler
10/05/2021, 2:05 PMKevin Weiler
10/05/2021, 2:06 PMKevin Kho
Kevin Weiler
10/05/2021, 2:09 PMKevin Kho
Kevin Weiler
10/05/2021, 2:14 PMKevin Weiler
10/05/2021, 2:14 PMKevin Kho
Kevin Weiler
10/05/2021, 2:20 PMKevin Kho
Kevin Weiler
10/05/2021, 3:03 PMKevin Kho