mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Fix issue where subjobs were not updating parent job json
This commit is contained in:
@@ -168,7 +168,7 @@ def subjob_status_change(job_id):
|
|||||||
try:
|
try:
|
||||||
subjob_details = request.json
|
subjob_details = request.json
|
||||||
logger.info(f"Subjob to job id: {job_id} is now {subjob_details['status']}")
|
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)
|
return Response(status=200)
|
||||||
except JobNotFoundError:
|
except JobNotFoundError:
|
||||||
return "Job not found", 404
|
return "Job not found", 404
|
||||||
|
|||||||
@@ -82,12 +82,12 @@ class DistributedJobManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@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.
|
Responds to a status change from a remote subjob and triggers the creation or modification of subjobs as needed.
|
||||||
|
|
||||||
Parameters:
|
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.
|
subjob_data (dict): Subjob data sent from the remote server.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -100,9 +100,10 @@ class DistributedJobManager:
|
|||||||
subjob_key = f'{subjob_id}@{subjob_hostname}'
|
subjob_key = f'{subjob_id}@{subjob_hostname}'
|
||||||
|
|
||||||
# Update the local job's subjob data
|
# 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
|
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'])
|
subjob_status = string_to_status(subjob_data['status'])
|
||||||
logger.debug(f"Subjob status changed: {logname} -> {subjob_status.value}")
|
logger.debug(f"Subjob status changed: {logname} -> {subjob_status.value}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user