Skip to content

vllm.distributed.ec_transfer.ec_connector.mooncake.state

Scheduler-owned lifecycle and indexes for Consumer-bound transfers.

Classes:

SchedulerTransfer dataclass

Track one transfer as observed by the Scheduler.

SchedulerTransferState

Bases: Enum

Lifecycle states visible to the Scheduler.

The states cover waiting for a Consumer event, dispatching a Worker load, retaining a locally reusable tensor, and terminal failure conditions.

SchedulerTransferTable

Own Scheduler transfer state, lookup indexes, and dispatch queues.

The Scheduler is single-threaded, so direct transitions are sufficient; the Producer and Consumer managers retain stricter transition matrices because callbacks and control requests can race there.

Methods:

  • drain_orphaned –

    Transfer IDs expired out of READY/RESIDENT since the last drain.

  • invalidate_local –

    Expire consumed local transfers after an encoder-cache reset.

  • wait_for_event –

    Track a request waiting for a push.

_refuse_colliding_id(record, mm_hash, request_id)

Report a transfer id that already names another encoding.

Transfer ids arrive on the request, so a collision is reachable from outside and must not reach the engine as an exception.

drain_orphaned()

Transfer IDs expired out of READY/RESIDENT since the last drain.

The caller must release the consumer worker's reservation for each: cancel() still accepts an EXPIRED record, so the usual cancel path applies.

invalidate_local(now)

Expire consumed local transfers after an encoder-cache reset.

READY and RESIDENT records have already been loaded, so ConsumerReservationManager.take() has consumed their Worker reservation. Leaving them in place would let a later request treat a dead transfer_id as a remote cache hit. Unconsumed AVAILABLE reservations stay Load-able. In-flight WAITING_EVENT and LOADING records are left to the existing async flow; this does not claim in-flight reset concurrency safety.

wait_for_event(transfer_id, request_id, mm_hash, deadline)

Track a request waiting for a push.

Returns None when transfer_id already names a different encoding. The id comes from the request, so a collision has to fail that one request; re-issuing it re-runs the encode under a fresh id.