Fix issue where subjobs were not updating parent job json

This commit is contained in:
Brett Williams
2023-10-25 11:46:09 -05:00
parent 0730b20c52
commit fca2a9f441
2 changed files with 5 additions and 4 deletions

View File

@@ -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

View File

@@ -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}")