run_command
- class pcs.run_command.RunCommand(component: Component, entry_point: str, argument_set: ArgumentSet, log_return_value: bool)
A RunCommand contains everything required to reproducibly execute a Component Entry Point. Unlike a Run, a RunCommand is not concerned with the outputs of the execution (see :py:func:pcs.Run: for more on that.)
You can think of a RunCommand as a glorified dictionary containing the pointers to arguments and versions of code necessary to reproduce the setting up of a component (including its dependency dag) and the execution of one of its entry points with a specific ArgumentSet. Whereas a Run itself (which may contain a RunCommand) is more like a client to a backing store used various types of outputs of the code being executed.
Our concept of a RunCommand is inspired by the MLflow
Project Run
abstraction. In MLflow runs of Projects (which are roughly analogous to our Components) are intertwined with MLflow’s concept of Runs for tracking purposes. In MLflow, a Project Run is a wrapper around an MLflow tracking Run.In MLflow, an entry point exists in the context of a Project Run. A project Run uses Tags on the underlying tracking run to log all sorts of metadata, including the entry point, per https://github.com/mlflow/mlflow/blob/v1.22.0/mlflow/projects/utils.py#L225 and https://github.com/mlflow/mlflow/blob/v1.22.0/mlflow/utils/mlflow_tags.py
- __init__(component: Component, entry_point: str, argument_set: ArgumentSet, log_return_value: bool)
RunCommand constructor.
- Parameters
component – The Component whose entry point is being run.
entry_point – The Entry Point being run.
argument_set – Dictionary of arguments that will be used to initialize the Component plus any of its dependencies and run the specified Entry Point.
log_return_value – Whether or not to log the return value of the Entry point as part of this run. If True, the return value will be serialized to a file per the default value of the return_value_log_format parameter of Component.run_with_arg_set(). If the return value is a type that is not trivially serializable, you may want to set this to False.
- property argument_set
- property component
- property entry_point
- classmethod from_default_registry(run_id: str) pcs.run_command.RunCommand
- classmethod from_registry(registry: pcs.registry.Registry, run_command_id: str) pcs.run_command.RunCommand
- classmethod from_spec(run_cmd_spec: Mapping, registry: pcs.registry.Registry) pcs.run_command.RunCommand
- property identifier: str
- property log_return_value
- publish() None
This function is like :py:func:to_registry: but it writes the RunCommand to the default registry, whereas :py:func:to_registry: writes the RunCommand either to an explicitly provided registry object, or to a new InMemoryRegistry.
- run() pcs.run.Run
Create a new run using the same root component, entry point, and params as this RunCommand.
- Returns
a new RunCommand object representing the rerun.
- to_registry(registry: Optional[pcs.registry.Registry] = None, recurse: bool = True, force: bool = False) pcs.registry.Registry
Returns a registry (which may optionally already exist) containing a run spec for this run. If recurse is True, also adds the component that was run to the registry by calling
.to_registry()
on it, and passing the given registry arg as well as the recurse and force args through to that call.For details on those flags, see :py:func:pcs.Component.to_registry:
- to_spec(flatten: bool = False) Mapping