Skip to content

Commit

Permalink
fix: show clearer errors in more situations
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Jan 7, 2024
1 parent 08b9422 commit 9e88fd6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion horde_worker_regen/process_management/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,11 @@ async def api_job_pop(self) -> None:
if self._process_map.get_first_available_inference_process() is None:
return

if len(self.bridge_data.image_models_to_load) == 0:
logger.error("No models are configured to be loaded, please check your config (models_to_load).")
await asyncio.sleep(3)
return

# If there are long running jobs, don't start any more even if there is space in the deque
if self.should_wait_for_pending_megapixelsteps():
if self._triggered_max_pending_megapixelsteps is False:
Expand Down Expand Up @@ -1901,7 +1906,7 @@ async def api_job_pop(self) -> None:
job_pop_request = ImageGenerateJobPopRequest(
apikey=self.bridge_data.api_key,
name=self.bridge_data.dreamer_worker_name,
bridge_agent="AI Horde Worker reGen:3.0.4:https://github.com/Haidra-Org/horde-worker-reGen",
bridge_agent="AI Horde Worker reGen:3.0.8:https://github.com/Haidra-Org/horde-worker-reGen",
models=self.bridge_data.image_models_to_load,
nsfw=self.bridge_data.nsfw,
threads=self.max_concurrent_inference_processes,
Expand All @@ -1924,6 +1929,15 @@ async def api_job_pop(self) -> None:
if isinstance(job_pop_response, RequestErrorResponse):
if "maintenance mode" in job_pop_response.message:
logger.warning(f"Failed to pop job (Maintenance Mode): {job_pop_response}")
elif "we cannot accept workers serving" in job_pop_response.message:
logger.warning(f"Failed to pop job (Unrecognized Model): {job_pop_response}")
logger.error(
"Your worker is configured to use a model that is not accepted by the API. "
"Please check your models_to_load and make sure they are all valid.",
)
elif "wrong credentials" in job_pop_response.message:
logger.warning(f"Failed to pop job (Wrong Credentials): {job_pop_response}")
logger.error("Did you forget to set your worker name?")
else:
logger.error(f"Failed to pop job (API Error): {job_pop_response}")
self._job_pop_frequency = self._error_job_pop_frequency
Expand Down

0 comments on commit 9e88fd6

Please sign in to comment.