From 32d863f624bdec2b9453329e485f3e3b0aa46b3e Mon Sep 17 00:00:00 2001 From: Brett Williams Date: Wed, 25 Oct 2023 06:37:46 -0500 Subject: [PATCH] Cancel all children if parent job is cancelled --- src/distributed_job_manager.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/distributed_job_manager.py b/src/distributed_job_manager.py index c09e078..1120fd9 100644 --- a/src/distributed_job_manager.py +++ b/src/distributed_job_manager.py @@ -52,9 +52,11 @@ class DistributedJobManager: parent_id, hostname = render_job.parent.split('@')[0], render_job.parent.split('@')[-1] RenderServerProxy(hostname).notify_parent_of_status_change(parent_id=parent_id, subjob=render_job) - elif render_job.children and new_status == RenderStatus.CANCELLED: - # todo: handle cancelling all the children - pass + # handle cancelling all the children + elif render_job.children and new_status in [RenderStatus.CANCELLED, RenderStatus.ERROR]: + for child in render_job.children: + child_id, hostname = child.split('@') + RenderServerProxy(hostname).cancel_job(child_id, confirm=True) # UI Notifications if new_status == RenderStatus.COMPLETED: