inform in the case of worker timeout

pull/2/head
unknown 2023-03-24 13:25:02 -05:00
parent 46929e949a
commit 162b541d4e
No known key found for this signature in database
GPG Key ID: CA376082283AF69A
2 changed files with 56 additions and 57 deletions

View File

@ -6,9 +6,7 @@ import base64
import io import io
import json import json
import re import re
import gradio import gradio
from modules import scripts, script_callbacks from modules import scripts, script_callbacks
from modules import processing from modules import processing
from threading import Thread from threading import Thread
@ -23,9 +21,6 @@ from scripts.spartan.World import World, NotBenchmarked, WorldAlreadyInitialized
from scripts.spartan.Worker import Worker from scripts.spartan.Worker import Worker
from modules.shared import opts from modules.shared import opts
path_root = scripts.basedir()
# TODO implement SSDP advertisement of some sort in sdwui api to allow extension to automatically discover workers? # TODO implement SSDP advertisement of some sort in sdwui api to allow extension to automatically discover workers?
# TODO see if the current api has some sort of UUID generation functionality. # TODO see if the current api has some sort of UUID generation functionality.

View File

@ -1,3 +1,4 @@
import gradio
import requests import requests
from typing import List from typing import List
import math import math
@ -248,8 +249,8 @@ class Worker:
""" """
eta = None eta = None
# TODO handle no connection exception and remove worker (for this request) in that case
# TODO detect remote out of memory exception and restart or garbage collect instance using api? # TODO detect remote out of memory exception and restart or garbage collect instance using api?
try:
# query memory available on worker and store for future reference # query memory available on worker and store for future reference
if self.queried is False: if self.queried is False:
self.queried = True self.queried = True
@ -308,6 +309,9 @@ class Worker:
else: else:
raise InvalidWorkerResponse(e) raise InvalidWorkerResponse(e)
except requests.exceptions.ConnectTimeout:
print(f"\nTimed out waiting for worker '{self.uuid}' at {self}")
return return
def benchmark(self) -> int: def benchmark(self) -> int: