Skip to content

process

Process submodule providing functionality related to processes and their execution.

Process

Process(
    components: Iterable[Component],
    connectors: Iterable[Connector],
    name: Optional[str] = None,
    parameters: Optional[dict] = None,
    state: Optional[StateBackend] = None,
)

Bases: ExportMixin, ABC

Process is a base class for managing components in a model.

Instantiates a Process.

Parameters:

Name Type Description Default
components Iterable[Component]

The components in the Process.

required
connectors Iterable[Connector]

The connectors between the components.

required
name Optional[str]

Optional; Name for this Process.

None
parameters Optional[dict]

Optional; Parameters for the Process.

None
state Optional[StateBackend]

Optional; StateBackend for the Process.

None

id property

id: str

Unique ID for Process.

is_initialised property

is_initialised: bool

Returns whether the Process is initialised.

state property

state: StateBackend

State backend for the process.

status property

status: Status

Returns the current status of the Process.

__aenter__ async

__aenter__() -> Process

Enters the context manager.

__aexit__ async

__aexit__(
    exc_type: Optional[Type[BaseException]],
    exc_value: Optional[BaseException],
    traceback: Optional[TracebackType],
) -> None

Exits the context manager.

connect_state async

connect_state(state: Optional[StateBackend] = None) -> None

Connects the Process to the StateBackend.

destroy async

destroy() -> None

Performs tear-down actions for the Process and its Components.

dump

dump(path: Path | str) -> None

Saves to Process configuration to a YAML file for use with the CLI.

Parameters:

Name Type Description Default
path Path | str

The path to the YAML file. Will be overwritten if it exists.

required

init abstractmethod async

init() -> None

Performs component initialisation actions.

run abstractmethod async

run() -> None

Runs the process to completion.

step abstractmethod async

step() -> None

Executes a single step for the process.

LocalProcess

LocalProcess(
    components: Iterable[Component],
    connectors: Iterable[Connector],
    name: Optional[str] = None,
    parameters: Optional[dict] = None,
    state: Optional[StateBackend] = None,
)

Bases: Process

LocalProcess manages components in a process model on a single processor.

destroy async

destroy() -> None

Performs tear-down actions for the LocalProcess and its Components.

init async

init() -> None

Performs component initialisation actions.

run async

run() -> None

Runs the process to completion.

step async

step() -> None

Executes a single step for the process.

RayProcess

RayProcess(
    components: Iterable[Component],
    connectors: Iterable[Connector],
    name: Optional[str] = None,
    parameters: Optional[dict] = None,
    state: Optional[StateBackend] = None,
)

Bases: Process

RayProcess manages components in a process model on a multiple Ray actors.

Instantiates a RayProcess.

Parameters:

Name Type Description Default
components Iterable[Component]

The components in the Process.

required
connectors Iterable[Connector]

The connectors between the components.

required
name Optional[str]

Optional; Name for this Process.

None
parameters Optional[dict]

Optional; Parameters for the Process.

None
state Optional[StateBackend]

Optional; StateBackend for the Process.

None

destroy async

destroy() -> None

Performs tear-down actions for the RayProcess and its Components.

init async

init() -> None

Performs component initialisation actions.

run async

run() -> None

Runs the process to completion.

step async

step() -> None

Executes a single step for the process.