From 7dff2e339395bbdbaedadaf23207d493376145a6 Mon Sep 17 00:00:00 2001 From: Brett Williams Date: Wed, 25 Oct 2023 11:46:09 -0500 Subject: [PATCH] Fix issue where subjobs were not updating parent job json --- src/api/api_server.py | 2 +- src/distributed_job_manager.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/api/api_server.py b/src/api/api_server.py index 1eab8fb..dc6fe47 100755 --- a/src/api/api_server.py +++ b/src/api/api_server.py @@ -168,7 +168,7 @@ def subjob_status_change(job_id): try: subjob_details = request.json logger.info(f"Subjob to job id: {job_id} is now {subjob_details['status']}") - DistributedJobManager.handle_subjob_status_change(RenderQueue.job_with_id(job_id), subjob_data=subjob_details) + DistributedJobManager.handle_subjob_status_change(job_id, subjob_data=subjob_details) return Response(status=200) except JobNotFoundError: return "Job not found", 404 diff --git a/src/distributed_job_manager.py b/src/distributed_job_manager.py index 203e90a..f2fa30b 100644 --- a/src/distributed_job_manager.py +++ b/src/distributed_job_manager.py @@ -82,12 +82,12 @@ class DistributedJobManager: ) @classmethod - def handle_subjob_status_change(cls, local_job, subjob_data): + def handle_subjob_status_change(cls, local_job_id, subjob_data): """ Responds to a status change from a remote subjob and triggers the creation or modification of subjobs as needed. Parameters: - local_job (BaseRenderWorker): The local parent job worker. + local_job_id (str): ID for local parent job worker. subjob_data (dict): Subjob data sent from the remote server. Returns: @@ -100,9 +100,10 @@ class DistributedJobManager: subjob_key = f'{subjob_id}@{subjob_hostname}' # Update the local job's subjob data + local_job.children = dict(local_job.children) # copy as dict to work around sqlalchemy update issue local_job.children[subjob_key] = subjob_data - logname = f"{local_job.id}:{subjob_key}" + logname = f"{local_job_id}:{subjob_key}" subjob_status = string_to_status(subjob_data['status']) logger.debug(f"Subjob status changed: {logname} -> {subjob_status.value}")