Routing Model
DefendableRouter routes GPU compute jobs to registered workers. There is no ENS, App ID, or Agent ID path resolution — routing is a match between a queued job’s requested GPU SKU and job type and a worker’s declared capabilities.
Job types
Section titled “Job types”inference · fine_tune · eval · dataset_build · embedding · batch
Job statuses
Section titled “Job statuses”queued · leased · running · completed · failed · canceled
The terminal (final) statuses are completed, failed, and canceled.
The v0.2 lease lifecycle
Section titled “The v0.2 lease lifecycle”The lease flow lives in services/leases.py:
-
lease_next_job— a worker callsPOST /workers/jobs/leasewith itssupported_job_typesandsupported_gpu_skus. The router intersects the worker’s declared capabilities (from its registrationcapabilities.gpu_skus) with the request, then picks the oldestqueuedjob whoserequested_gpu_skuandjob_typematch. It mints a hashedlease_token(only the hash is stored) withDEFAULT_LEASE_SECONDS = 600(10-minute TTL), sets the job toleased, marks the workerbusy, links the assigned node, and writes ajob_leasedreceipt plus acompute_job/fine_tune_job(leased phase) receipt. -
accept_job—POST /workers/jobs/{id}/acceptverifies the active lease (token ownership viahmac.compare_digest, not expired) and moves the job torunning; writes aworker_job_acceptedreceipt. -
Status / logs / artifacts —
record_worker_statusand the artifact route append status events and anartifact_reportedreceipt; each verifies the active lease first. -
complete_worker_job—POST /workers/jobs/{id}/completecomputesactual_hoursfrom the start/finish timestamps (or a suppliedduration_seconds), derivesactual_cost_usdvia server-side pricing (services/billing.actual_compute_cost), sets the jobcompleted, completes the lease, and writescompute_job/fine_tune_job(completed phase) plus aworker_job_completedreceipt. The job’sreceipt_idis set to the completion receipt. -
fail_worker_job—POST /workers/jobs/{id}/failsets the jobfailed, releases the lease and node, and writes aworker_job_failedreceipt. No compute charge is applied on failure in v0.2 (amount0.00). -
expire_stale_leases— any active lease pastexpires_atis markedexpired; if its job is not in a final status, the job is returned toqueued(and unassigned from its node), and alease_expiredreceipt is written.
Capability matching
Section titled “Capability matching”A worker only leases jobs whose requested_gpu_sku is in the intersection of the worker’s
registered gpu_skus and the SKUs it offers at lease time, and whose job_type is one of the six
valid types. If there is no capability overlap or no matching queued job, the lease returns empty.
See the Worker Contract (v0.2) for the full request/response shapes and Receipt Capture for the receipts each step mints.
🐝 Operator-grade · books and records · to the shed.