Skip to content

Commit

Permalink
[BUG] Cancel tasks when emitting TASK_CANCEL events.
Browse files Browse the repository at this point in the history
  • Loading branch information
sukritkalra committed Apr 7, 2024
1 parent cf8f9c6 commit e04afb7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1317,14 +1317,16 @@ def __handle_task_placement(self, event: Event, workload: Workload) -> None:
del self._future_placement_events[task.id]
if task.state != TaskState.CANCELLED:
# If the TaskGraph was cancelled, but the Task was not, then we
# emit a specific cancellation event so that the status is
# correctly available to the schedulers.
task_cancellation_event = Event(
event_type=EventType.TASK_CANCEL,
time=event.time,
task=task,
)
self._event_queue.add_event(task_cancellation_event)
# emit a specific cancellation event for all the tasks from this
# task so that the status is correctly available to the schedulers.
for cancelled_task in task_graph.cancel(task, event.time):
self._event_queue.add_event(
Event(
event_type=EventType.TASK_CANCEL,
time=cancelled_task.cancellation_time,
task=cancelled_task,
)
)
return
else:
# If the Task is not ready to run and wasn't cancelled,
Expand Down

0 comments on commit e04afb7

Please sign in to comment.