dynamo.mocker
dynamo.mocker publishes 2 classes and 23 functions. Source: components/src/dynamo/mocker/__init__.py
ProfileDataResult (class)
Result of processing —planner-profile-data argument. Cleans up tmpdir on deletion.
npz_path is the lookup-table file, ais_perf_model the AIS perf model
file written for a profiler results directory; at most one is set.
components/src/dynamo/mocker/args.py#L35
Public methods
init
No summary available.
ReasoningConfig (class)
No summary available.
lib/bindings/python/src/dynamo/_core.pyi#L2166
Public methods
init
No summary available.
apply_worker_engine_args_overrides (function)
build_mocker_engine_args (function)
build_mocker_parser (function)
The argument parser of a mocker that runs with env.
Env defaults come from env only, never os.environ. Registers what
parse_args registers, without --help and --version. Parsing
--ais-perf-config reads its file; to read no local file, give a
parser that keeps values as typed. Nothing parse_args does after
parsing is done here: call set_ais_perf_model_attributes on the parsed
namespace before old_ais_perf_inputs reads it.
build_runtime_config (function)
compute_stagger_delay (function)
Compute the stagger delay based on worker count to give the frontend time to process registrations. Returns the delay in seconds between worker launches.
engine_limit (function)
graceful_shutdown (function)
Shutdown dynamo distributed runtime instances. The endpoints will be immediately invalidated so no new requests will be accepted.
launch_workers (function)
Launch mocker worker(s) with isolated DistributedRuntime instances.
Each worker gets its own DistributedRuntime, which means:
- Separate etcd/NATS connections
- Separate Component instances (no shared overhead)
- Independent service registration and stats scraping
- But still sharing the same tokio runtime (efficient)
load_mocker_engine_args (function)
main (function)
normalize_mocker_config (function)
old_ais_perf_inputs (function)
Return the names of the old AIS perf model inputs args holds.
These are --ais-perf-model without a value, --ais-perf-config and
the flat identity flags, named with the --ais- spelling. An attribute
that args does not have counts as not given.
parse_args (function)
Parse command-line arguments for the Dynamo mocker engine.
Returns
argparse.Namespace— argparse.Namespace: Parsed command-line arguments.
parse_bootstrap_ports (function)
Parse comma-separated bootstrap ports string into list of integers.
performance_config (function)
prefetch_model (function)
Resolve model_path to a local directory, fetching config/tokenizer if needed.
fetch_model returns the cached snapshot directory without contacting the
hub when config.json and the tokenizer files are already present, and downloads
only those files otherwise. Resolving once here means neither the workers nor
the KV-bytes estimate below resolve a hub ID over the network. Returns the
original path on failure so callers degrade to their previous behavior.
resolve_planner_profile_data (function)
Resolve —planner-profile-data to a timing source.
Accepts either:
- A mocker-format NPZ file with lookup tables (returned as-is)
- A profiler-style results directory. An AIS perf model is tuned with its measured points and written to a temporary directory.
Parameters
Path from —planner-profile-data argument.
Model name recorded in the AIS perf model of a directory; the
name of the directory when None.
Engine backend recorded in that AIS perf model.
Speculative decoding depth recorded in that AIS perf model.
Returns
ProfileDataResult— ProfileDataResult with npz_path or ais_perf_model, and the tmpdir for cleanup.
Raises
FileNotFoundError— If path doesn’t contain valid profile data in any supported format.ValueError— If the points of a directory do not allow a fit.
run_mocker_trace_replay (function)
set_ais_perf_model_attributes (function)
Replace the recorded uses of --ais-perf-model by three attributes.
env is DYN_AIS_PERF_MODEL of the mocker args was parsed for;
None or empty is unset. Sets ais_perf_model_without_value,
ais_perf_model_value (the value typed last, else env) and
ais_perf_model_source (the name of what gave the value). A
combination with no single meaning is an error of parser.
use_planner_profile_data (function)
Resolve --planner-profile-data and make it the timing input of args.
A lookup-table file stays in args.planner_profile_data. A profiler
results directory becomes the AIS perf model value of args, tuned for
--model-path, --engine-type and --ais-nextn; together with an
old AIS input it is a ValueError. With --extra-engine-args the
profile data is not used for timing, as before.
The result owns the temporary directory of that AIS perf model: keep it until the workers have stopped.
validate_systemone_serial_config (function)
Gate the serial capability on the effective scheduler configuration.
validate_worker_type_args (function)
Resolve disaggregation mode from —disaggregation-mode or legacy boolean flags. Raises ValueError if validation fails.
worker (function)
Main worker function that launches mocker instances.
Each mocker gets its own DistributedRuntime instance for true isolation, while still sharing the same event loop and tokio runtime.