Skip to content

dlgforge.distributed

Public exports for distributed runtime helpers.

RunBootstrap(config_path, cfg)

Manage distributed bootstrap lifecycle around a generation run.

Parameters:

Name Type Description Default
config_path str | Path

Path to a configuration file.

required
cfg Dict[str, Any]

Configuration mapping that controls runtime behavior.

required

Raises:

Type Description
Exception

Construction may raise when required dependencies or inputs are invalid.

Side Effects / I/O: - May perform network, model, or distributed runtime operations. - May read environment variables or mutate process-level runtime state.

Preconditions / Invariants: - Instantiate and use through documented public methods.

Examples:

>>> from dlgforge.distributed.bootstrap import RunBootstrap
>>> RunBootstrap(...)

run(cfg) async

Provision runtime dependencies and execute the configured run.

Parameters:

Name Type Description Default
cfg Dict[str, Any]

Configuration mapping that controls runtime behavior.

required

Returns:

Name Type Description
None None

No value is returned.

Raises:

Type Description
RuntimeError

Raised when validation or runtime requirements are not met.

Side Effects / I/O: - May perform network, model, or distributed runtime operations. - May read environment variables or mutate process-level runtime state.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.bootstrap import RunBootstrap
>>> instance = RunBootstrap(...)
>>> instance.run(...)

AttachProvisioner

Provisioner for attach runtime resources.

Raises:

Type Description
Exception

Construction may raise when required dependencies or inputs are invalid.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Instantiate and use through documented public methods.

Examples:

>>> from dlgforge.distributed.provisioning import AttachProvisioner
>>> AttachProvisioner(...)

start(cfg) async

Start provisioned runtime resources.

Parameters:

Name Type Description Default
cfg Dict[str, Any]

Configuration mapping that controls runtime behavior.

required

Returns:

Type Description
List[EndpointSpec]

List[EndpointSpec]: Value produced by this API.

Raises:

Type Description
RuntimeError

Raised when validation or runtime requirements are not met.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.provisioning import AttachProvisioner
>>> instance = AttachProvisioner(...)
>>> instance.start(...)

stop() async

Stop provisioned runtime resources.

Returns:

Name Type Description
None None

No value is returned.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.provisioning import AttachProvisioner
>>> instance = AttachProvisioner(...)
>>> instance.stop(...)

ManagedRayVLLMProvisioner()

Managed ray VLLM provisioner.

Raises:

Type Description
Exception

Construction may raise when required dependencies or inputs are invalid.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Instantiate and use through documented public methods.

Examples:

>>> from dlgforge.distributed.provisioning import ManagedRayVLLMProvisioner
>>> ManagedRayVLLMProvisioner(...)

start(cfg) async

Start provisioned runtime resources.

Parameters:

Name Type Description Default
cfg Dict[str, Any]

Configuration mapping that controls runtime behavior.

required

Returns:

Type Description
List[EndpointSpec]

List[EndpointSpec]: Value produced by this API.

Raises:

Type Description
RuntimeError

Raised when validation or runtime requirements are not met.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.provisioning import ManagedRayVLLMProvisioner
>>> instance = ManagedRayVLLMProvisioner(...)
>>> instance.start(...)

stop() async

Stop provisioned runtime resources.

Returns:

Name Type Description
None None

No value is returned.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.provisioning import ManagedRayVLLMProvisioner
>>> instance = ManagedRayVLLMProvisioner(...)
>>> instance.stop(...)

NoopProvisioner

Provisioner for noop runtime resources.

Raises:

Type Description
Exception

Construction may raise when required dependencies or inputs are invalid.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Instantiate and use through documented public methods.

Examples:

>>> from dlgforge.distributed.provisioning import NoopProvisioner
>>> NoopProvisioner(...)

start(cfg) async

Start provisioned runtime resources.

Parameters:

Name Type Description Default
cfg Dict[str, Any]

Configuration mapping that controls runtime behavior.

required

Returns:

Type Description
List[EndpointSpec]

List[EndpointSpec]: Value produced by this API.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.provisioning import NoopProvisioner
>>> instance = NoopProvisioner(...)
>>> instance.start(...)

stop() async

Stop provisioned runtime resources.

Returns:

Name Type Description
None None

No value is returned.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.provisioning import NoopProvisioner
>>> instance = NoopProvisioner(...)
>>> instance.stop(...)

VLLMProvisioner

Bases: Protocol

Provisioner for vllm runtime resources.

Raises:

Type Description
Exception

Construction may raise when required dependencies or inputs are invalid.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Instantiate and use through documented public methods.

Examples:

>>> from dlgforge.distributed.provisioning import VLLMProvisioner
>>> VLLMProvisioner(...)

start(cfg) async

Start provisioned runtime resources.

Parameters:

Name Type Description Default
cfg Dict[str, Any]

Configuration mapping that controls runtime behavior.

required

Returns:

Type Description
List[EndpointSpec]

List[EndpointSpec]: Value produced by this API.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.provisioning import VLLMProvisioner
>>> instance = VLLMProvisioner(...)
>>> instance.start(...)

stop() async

Stop provisioned runtime resources.

Returns:

Name Type Description
None None

No value is returned.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May perform network, model, or distributed runtime operations.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.provisioning import VLLMProvisioner
>>> instance = VLLMProvisioner(...)
>>> instance.stop(...)

EndpointSpec(name, base_url, api_key='', weight=1.0, max_in_flight=64, timeout_s=None) dataclass

Specification for a routed model endpoint.

Parameters:

Name Type Description Default
name str

str value used by this operation.

required
base_url str

str value used by this operation.

required
api_key str

str value used by this operation.

''
weight float

float value used by this operation.

1.0
max_in_flight int

int value used by this operation.

64
timeout_s float | None

float | None value used by this operation.

None

Raises:

Type Description
Exception

Construction may raise when required dependencies or inputs are invalid.

Side Effects / I/O: - Primarily performs in-memory transformations.

Preconditions / Invariants: - Instantiate and use through documented public methods.

Examples:

>>> from dlgforge.distributed.types import EndpointSpec
>>> EndpointSpec(...)

to_routing_dict()

To routing dict.

Returns:

Type Description
Dict[str, Any]

Dict[str, Any]: Value produced by this API.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - Primarily performs in-memory transformations.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.types import EndpointSpec
>>> instance = EndpointSpec(...)
>>> instance.to_routing_dict(...)

run_bootstrap(config_path, cfg)

Run bootstrap.

Parameters:

Name Type Description Default
config_path str | Path

Path to a configuration file.

required
cfg Dict[str, Any]

Configuration mapping that controls runtime behavior.

required

Returns:

Name Type Description
None None

No value is returned.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May perform network, model, or distributed runtime operations. - May read environment variables or mutate process-level runtime state.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.distributed.bootstrap import run_bootstrap
>>> run_bootstrap(...)