vllm.distributed.aux_output_connector.object_store
¶
Shared object stores that deliver auxiliary outputs to other processes.
Classes:
-
AuxObjectStore–A store of immutable objects that outlive the processes writing and
-
AuxObjectWriter–Write objects in the background, as safetensors with one array per
-
MooncakeAuxObjectStore–AuxObjectStoreon a standalone Mooncake store.
Functions:
-
aux_object_cache_salt–The cache salt a request that writes objects under
key_prefixruns -
aux_prefix–Key prefix of every object under
key_prefix. -
aux_salt_dir–The key directory of the objects of requests with the client cache salt
-
aux_salt_prefix–Key prefix of every object of the requests with the client cache salt
-
client_cache_salt–The client cache salt
aux_object_cache_saltfolded intocache_salt. -
create_aux_object_store–Connect the object store
name:"mooncake", or the qualified name of -
read_aux_rows–Concatenate
fieldof the objectskeys; wait up totimeout_sin
Attributes:
-
DEFAULT_AUX_SALT_DIR–The key directory of the objects of requests without a cache salt, shared
-
EMPTY_AUX_SALT_DIR–The key directory of the objects of requests with the empty cache salt
DEFAULT_AUX_SALT_DIR = '@none'
module-attribute
¶
The key directory of the objects of requests without a cache salt, shared
by all of them; aux_salt_dir never returns it for a salt.
EMPTY_AUX_SALT_DIR = '@empty'
module-attribute
¶
The key directory of the objects of requests with the empty cache salt
"", so that every key directory is non-empty.
AuxObjectStore
¶
Bases: Protocol
A store of immutable objects that outlive the processes writing and
reading them. Keys are opaque strings. Writing a key that exists succeeds
and keeps the object written first. A refusal that may succeed later
raises vllm.distributed.aux_output_connector.store.BlockObjectStoreError
and is retried until the batch's deadline;
any other exception drops the batch. The class connects with the
classmethod create(**object_store_extra_config); the engine calls
put_batch, remove_prefix and close from one writer thread.
Methods:
-
get–Return the object, or
Noneif it does not exist (yet). -
remove_prefix–Remove the objects whose keys start with
prefix, as built by
AuxObjectWriter
¶
Write objects in the background, as safetensors with one array per
field. A batch not written within timeout_s of being queued is dropped:
the store refused it until then (refusals are retried every
_RETRY_INTERVAL_S), or it was still queued behind a put that had not
returned. A batch whose put fails otherwise is dropped at once. Each of
its objects gets a drop marker that readers stop at, which names the cause.
Once a batch the store refuses has waited _FULL_WARNING_INTERVAL_S, a
warning at most that often says how long it has waited.
Queuing waits while _MAX_QUEUED_BATCHES batches are queued or being
written, at most until the first of them is written or misses its deadline.
Once a batch has missed its deadline, until a put succeeds, queuing never
waits: a full queue drops the batch.
Methods:
-
close–Write what is queued, waiting until the last deadline at most; the
-
put–Queue
(key, fields)objects as one batch: a caller that puts once -
take_dropped–The keys of the objects dropped since the last call.
_expire(now)
¶
Drop the queued batches past their deadline; the batch being written past its deadline is settled by its put.
close()
¶
Write what is queued, waiting until the last deadline at most; the writer thread closes the store once it is done.
put(objects)
¶
Queue (key, fields) objects as one batch: a caller that puts once
per step waits at most once per step.
take_dropped()
¶
The keys of the objects dropped since the last call.
MooncakeAuxObjectStore
¶
AuxObjectStore on a standalone Mooncake store.
Methods:
-
create–Connect with the Mooncake configuration file
config_path, or the -
get–Return the object, or
Noneif it does not exist. -
put_batch–Write every object; raise
BlockObjectStoreErrorif Mooncake has no
create(config_path=None, hard_pin=False)
classmethod
¶
Connect with the Mooncake configuration file config_path, or the
one at MOONCAKE_CONFIG_PATH if it is None, with a master and pool
separate from any Mooncake KV store. Objects are written hard-pinned if
hard_pin, for a memory-only store; by default they are not pinned, for
a store that offloads to SSD on eviction.
get(key)
¶
Return the object, or None if it does not exist.
put_batch(keys, values)
¶
Write every object; raise BlockObjectStoreError if Mooncake has no
room for them (NO_AVAILABLE_HANDLE), RuntimeError on other errors.
aux_object_cache_salt(key_prefix, cache_salt)
¶
The cache salt a request that writes objects under key_prefix runs
with: requests share KV only with the same client cache salt and key
prefix, never with requests that write no objects or write under another
prefix.
aux_prefix(key_prefix)
¶
Key prefix of every object under key_prefix.
aux_salt_dir(cache_salt)
¶
The key directory of the objects of requests with the client cache salt
cache_salt: the salt percent-encoded (urllib.parse.quote with no safe
characters), so that a directory is non-empty, holds no / and no
directory's keys start with another's; EMPTY_AUX_SALT_DIR for "" and
DEFAULT_AUX_SALT_DIR without a salt.
aux_salt_prefix(key_prefix, cache_salt)
¶
Key prefix of every object of the requests with the client cache salt
cache_salt.
client_cache_salt(cache_salt)
¶
The client cache salt aux_object_cache_salt folded into cache_salt.
A salt that is no such fold is its own client salt.
create_aux_object_store(name, extra_config)
¶
Connect the object store name: "mooncake", or the qualified name of
a class that implements AuxObjectStore, with extra_config as the
keyword arguments of its create.
read_aux_rows(store, keys, field, timeout_s=600.0)
¶
Concatenate field of the objects keys; wait up to timeout_s in
total for objects still being written, unless the engine dropped them.