Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c9d701e8d3 | |||
| ec2ac0a21a | |||
| 2cde573c56 | |||
| b2e4a5db0c | |||
| 7437028cb2 | |||
| 02c8307af7 | |||
| 944f83fc03 | |||
| f56bbc0ebe |
+16
-17
@@ -66,6 +66,9 @@ class Backend:
|
|||||||
unsecured: bool = dataclasses.field(
|
unsecured: bool = dataclasses.field(
|
||||||
default_factory=lambda: bool(strtobool(os.environ.get("UNSECURED", "false"))),
|
default_factory=lambda: bool(strtobool(os.environ.get("UNSECURED", "false"))),
|
||||||
)
|
)
|
||||||
|
report_addr: str = dataclasses.field(
|
||||||
|
default_factory=lambda: os.environ.get("REPORT_ADDR", "https://run.vast.ai")
|
||||||
|
)
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
self.metrics = Metrics()
|
self.metrics = Metrics()
|
||||||
@@ -104,23 +107,19 @@ class Backend:
|
|||||||
|
|
||||||
#######################################Private#######################################
|
#######################################Private#######################################
|
||||||
def _fetch_pubkey(self):
|
def _fetch_pubkey(self):
|
||||||
command = ["curl", "-X", "GET", "https://run.vast.ai/pubkey/"]
|
report_addr = self.report_addr.rstrip("/")
|
||||||
result = subprocess.check_output(command, universal_newlines=True)
|
command = ["curl", "-X", "GET", f"{report_addr}/pubkey/"]
|
||||||
log.debug("public key:")
|
try:
|
||||||
log.debug(result)
|
result = subprocess.check_output(command, universal_newlines=True)
|
||||||
key = None
|
log.debug("public key:")
|
||||||
for _ in range(5):
|
log.debug(result)
|
||||||
try:
|
key = RSA.import_key(result)
|
||||||
key = RSA.import_key(result)
|
if key is not None:
|
||||||
break
|
return key
|
||||||
except ValueError as e:
|
except (ValueError , subprocess.CalledProcessError) as e:
|
||||||
log.debug(f"Error downloading key: {e}")
|
log.debug(f"Error downloading key: {e}")
|
||||||
time.sleep(15)
|
self.backend_errored("Failed to get autoscaler pubkey")
|
||||||
if key is None:
|
|
||||||
self._total_pubkey_fetch_errors += 1
|
|
||||||
if self._total_pubkey_fetch_errors >= MAX_PUBKEY_FETCH_ATTEMPTS:
|
|
||||||
self.backend_errored("Failed to get autoscaler pubkey")
|
|
||||||
return key
|
|
||||||
|
|
||||||
async def __handle_request(
|
async def __handle_request(
|
||||||
self,
|
self,
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ ENV_PATH="$WORKSPACE_DIR/worker-env"
|
|||||||
DEBUG_LOG="$WORKSPACE_DIR/debug.log"
|
DEBUG_LOG="$WORKSPACE_DIR/debug.log"
|
||||||
PYWORKER_LOG="$WORKSPACE_DIR/pyworker.log"
|
PYWORKER_LOG="$WORKSPACE_DIR/pyworker.log"
|
||||||
|
|
||||||
REPORT_ADDR="${REPORT_ADDR:-https://cloud.vast.ai/api/v0,https://run.vast.ai}"
|
REPORT_ADDR="${REPORT_ADDR:-https://run.vast.ai}"
|
||||||
USE_SSL="${USE_SSL:-true}"
|
USE_SSL="${USE_SSL:-true}"
|
||||||
WORKER_PORT="${WORKER_PORT:-3000}"
|
WORKER_PORT="${WORKER_PORT:-3000}"
|
||||||
mkdir -p "$WORKSPACE_DIR"
|
mkdir -p "$WORKSPACE_DIR"
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ def call_text2image_workflow(
|
|||||||
endpoint=route_response["endpoint"],
|
endpoint=route_response["endpoint"],
|
||||||
reqnum=route_response["reqnum"],
|
reqnum=route_response["reqnum"],
|
||||||
url=route_response["url"],
|
url=route_response["url"],
|
||||||
|
request_idx=route_response["request_idx"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Build the payload for the worker request
|
# Build the payload for the worker request
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ def call_custom_workflow_for_sd3(
|
|||||||
endpoint=message["endpoint"],
|
endpoint=message["endpoint"],
|
||||||
reqnum=message["reqnum"],
|
reqnum=message["reqnum"],
|
||||||
url=message["url"],
|
url=message["url"],
|
||||||
|
request_idx=message["request_idx"],
|
||||||
)
|
)
|
||||||
workflow = {
|
workflow = {
|
||||||
"3": {
|
"3": {
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ backend = Backend(
|
|||||||
for error_msg in MODEL_SERVER_ERROR_LOG_MSGS
|
for error_msg in MODEL_SERVER_ERROR_LOG_MSGS
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
max_wait_time=600
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ backend = Backend(
|
|||||||
for error_msg in MODEL_SERVER_ERROR_LOG_MSGS
|
for error_msg in MODEL_SERVER_ERROR_LOG_MSGS
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
max_wait_time=600
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user