Skip to content

Commit

Permalink
Use open workers first
Browse files Browse the repository at this point in the history
  • Loading branch information
zten authored and tazlin committed Dec 14, 2023
1 parent 90de09d commit fcb6a50
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions horde_worker_regen/process_management/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,17 +1190,16 @@ def preload_models(self) -> bool:
if model_is_loaded:
continue

available_process = None
available_process = self._process_map.get_first_available_inference_process()
model_to_unload = self._lru.append(job.model)
if model_to_unload is not None:

if available_process is None and model_to_unload is not None:
for p in self._process_map.values():
if p.loaded_horde_model_name == model_to_unload and (
p.last_process_state == HordeProcessState.INFERENCE_COMPLETE
or p.last_process_state == HordeProcessState.WAITING_FOR_JOB
):
available_process = p
if available_process is None:
available_process = self._process_map.get_first_available_inference_process()

if available_process is None:
return False
Expand Down

0 comments on commit fcb6a50

Please sign in to comment.