Skip to content

Commit

Permalink
fix: handle when image_result is None
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 committed Jan 9, 2024
1 parent 96f3ed9 commit 2a399e2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions horde_worker_regen/process_management/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,9 @@ async def submit_single_generation(self, new_submit: PendingSubmitJob) -> Pendin
logger.error(f"Failed to upload image to R2: {response}")
new_submit.retry()
return new_submit

metadata = []
if new_submit.image_result is not None:
metadata = new_submit.image_result.generation_faults
submit_job_request_type = new_submit.completed_job_info.sdk_api_job_info.get_follow_up_default_request_type()
submit_job_request = submit_job_request_type(
apikey=self.bridge_data.api_key,
Expand All @@ -1675,7 +1677,7 @@ async def submit_single_generation(self, new_submit: PendingSubmitJob) -> Pendin
generation="R2", # TODO # FIXME
state=new_submit.completed_job_info.state,
censored=bool(new_submit.completed_job_info.censored), # TODO: is this cast problematic?
gen_metadata=new_submit.image_result.generation_faults,
gen_metadata=metadata,
)
job_submit_response = await self.horde_client_session.submit_request(
submit_job_request,
Expand Down

0 comments on commit 2a399e2

Please sign in to comment.