Skip to content

Commit

Permalink
fix: avoid exceptions on lock releases
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Mar 4, 2024
1 parent 31cc251 commit d79faf9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions horde_worker_regen/process_management/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,9 +1120,16 @@ def _replace_inference_process(self, process_info: HordeProcessInfo) -> None:
logger.warning(f"Job {job.id_} not found in job_pop_timestamps")

if process_info.last_process_state == HordeProcessState.INFERENCE_STARTING:
self._inference_semaphore.release()
try:
self._inference_semaphore.release()
except ValueError:
logger.debug("Inference semaphore already released")
elif process_info.last_process_state == HordeProcessState.DOWNLOADING_AUX_MODEL:
self._aux_model_lock.release()
try:
self._aux_model_lock.release()
except ValueError:
logger.debug("Aux model lock already released")

self._start_inference_process(process_info.process_id)

total_num_completed_jobs: int = 0
Expand Down

0 comments on commit d79faf9

Please sign in to comment.