Skip to content

Commit

Permalink
Fix tasks stuck in CANCELLING
Browse files Browse the repository at this point in the history
Fixes an issue where executions would get stuck in `CANCELLING` status
because execution state advancement occurred before actually setting the
parent task as `CANCELED`. The advancement method would not unschedule child
tasks while parent tasks are in active states (such as `CANCELLING`), therefore
the execution would never transition into `ERROR` or `CANCELED` state.
  • Loading branch information
Dany9966 committed Jul 17, 2024
1 parent 190b2e7 commit 6869302
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions coriolis/conductor/rpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3286,6 +3286,10 @@ def confirm_task_cancellation(self, ctxt, task_id, cancellation_details):
"task '%s' (status '%s'). Marking as '%s' anyway.",
task.id, task.status, final_status)

db_api.set_task_status(
ctxt, task.id, final_status,
exception_details=exception_details)

if final_status == task.status:
LOG.debug(
"NOT altering state of finalized task '%s' ('%s') following "
Expand All @@ -3298,9 +3302,6 @@ def confirm_task_cancellation(self, ctxt, task_id, cancellation_details):
task.id, task.status, final_status)
execution = db_api.get_tasks_execution(ctxt, task.execution_id)
self._advance_execution_state(ctxt, execution, requery=False)
db_api.set_task_status(
ctxt, task.id, final_status,
exception_details=exception_details)

@parent_tasks_execution_synchronized
def set_task_error(self, ctxt, task_id, exception_details):
Expand Down

0 comments on commit 6869302

Please sign in to comment.