* feat: add Runpod serverless image collector pools * fix: prevent worker settings clipping and remove preview copy * fix: initialize worker settings before mounting the form * fix: validate complete serverless requests against 10 MB limit * fix: simplify serverless cards and keep status dots circular * fix: match serverless endpoint box to master card * fix: preserve serverless capacity and recovery across job failures Retain durable reservations until provider termination or explicit recovery, protect unresolved pools and credentials, and add scoped reconciliation. Consolidate lifecycle and secret policies and split prompt/media stages with regression coverage. * fix(serverless): disable Clear saved API key while the worker is enabled The checkbox read "Clear saved API key (disable pool first)", but the panel never defines "pool" and saving with it ticked on an enabled worker was rejected by the backend. - Disable the checkbox while the worker is enabled, with a tooltip saying to turn the worker off first. Also disable it when no key is saved. - Use "worker" instead of "pool" in user-facing serverless errors, the serverless guide and the README entry. * feat(serverless): replace Concurrent jobs with a single Images per run setting - Remove the separate Concurrent jobs field; rename Jobs per run to Images per run (1-16) with a tooltip explaining that Runpod's max workers decides how many GPUs run them. - Backend uses a fixed per-worker limit of 16 outstanding jobs, so all images of a run are submitted at once. Unresolved jobs still count against it. The limit is constant, so it never has to change while jobs are unresolved. - Legacy 'concurrency' in saved configs and older browser tabs is accepted and ignored/dropped; it no longer triggers the busy guard. - Revert the enable toggle and show the reason when the backend rejects it. - Trim a pasted api.runpod.ai/v2/<id> URL to the endpoint ID; plainer endpoint-ID error otherwise. - Confirm before a type change deletes a saved Runpod API key. - Update docs and tests.
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
"""Shared rules for provider capacity and durable recovery protection.
|
|
|
|
A local task ending is not evidence that provider work ended. RESOLVED is an
|
|
explicit operator acknowledgment, never a provider-reported state.
|
|
"""
|
|
|
|
PROVIDER_TERMINAL = frozenset({"COMPLETED", "FAILED", "CANCELLED", "TIMED_OUT"})
|
|
TERMINAL = PROVIDER_TERMINAL | {"RESOLVED"}
|
|
PROVIDER_STATES = PROVIDER_TERMINAL | {"IN_QUEUE", "IN_PROGRESS"}
|
|
|
|
|
|
def terminal_provider_status(response):
|
|
status = response.get("status") if isinstance(response, dict) else None
|
|
return status if isinstance(status, str) and status in PROVIDER_TERMINAL else None
|
|
|
|
|
|
def is_unresolved(record):
|
|
return record.get("status") not in TERMINAL
|
|
|
|
|
|
def occupies_capacity(record):
|
|
# WAITING is journalled before admission and cannot have been submitted.
|
|
# Every other unresolved state is conservatively reserved, including a
|
|
# submission whose provider ID was lost and an unconfirmed cancellation.
|
|
return is_unresolved(record) and (record.get("status") != "WAITING" or bool(record.get("job_id")))
|
|
|
|
|
|
def belongs_to_pool(record, worker_id):
|
|
return str(record.get("worker_id")) == str(worker_id)
|