The SDK talks directly to one PostgreSQL-backed Project Queue. It has no background heartbeat, shard route, generation, or inbound server.
from saveweb_hq import Config, open_project_queue
with open_project_queue(
Config(
machine_token=machine_token,
client_version="sinavideo/2.4.0",
),
"sinavideo",
) as queue:
response = queue.claim(max_jobs=64)
for job in response["jobs"]:
# Upload artifacts to the external Artifact Receiver, then include its
# receipts in complete().
...tracker_url defaults to https://hq.saveweb.org/. Set it explicitly only
when connecting to another HQ deployment.
Opening a queue generates a fresh seven-character a-z0-9 worker ID, exposed
as queue.worker_id and fixed for that queue instance.
Use saveweb_hq.whoami(config) to get the user ID associated with a machine or
project anonymous token without opening a project queue. Project anonymous
tokens return gh_0 and can open only their bound project.
complete, fail, and extend_lease accept bounded lists matching the
Project Queue OpenAPI contract.
With no lease_seconds argument, claim uses the project's
recommended_lease_seconds policy. The Python SDK does not renew leases in the
background; long-running Python workers must still call extend_lease.
Before claiming, the SDK periodically fetches project policy, clamps the batch
size, and applies the cooperative per-worker claim rate with monotonic timing
and a randomized initial phase. Explicit retryable HTTP 429 responses are
delayed using their precise retry_after_ms and retried automatically. Other
transport and API errors are returned to the caller.