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 05a450b..af81441 100644 --- a/src/distributed_job_manager.py +++ b/src/distributed_job_manager.py @@ -85,12 +85,12 @@ class DistributedJobManager: logger.debug(f"Unable to show UI notification: {e}") @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: @@ -103,9 +103,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}")