Skip to content

Runtime Configuration

zenml.runtime_configuration

RuntimeConfiguration (dict, Generic)

RuntimeConfiguration store dynamic options for a pipeline run.

Use stack.runtime_options() to get all available runtime options for the components of a specific ZenML stack.

This class is a dict subclass, so getting/setting runtime options is done using some_value = runtime_configuration["some_key"] and runtime_configuration["some_key"] = 1.

Source code in zenml/runtime_configuration.py
class RuntimeConfiguration(Dict[str, Any]):
    """RuntimeConfiguration store dynamic options for a pipeline run.

    Use `stack.runtime_options()` to get all available runtime options for the
    components of a specific ZenML stack.

    This class is a `dict` subclass, so getting/setting runtime options is done
    using `some_value = runtime_configuration["some_key"]` and
    `runtime_configuration["some_key"] = 1`.
    """

    def __init__(
        self,
        *,
        run_name: Optional[str] = None,
        schedule: Optional["Schedule"] = None,
        **runtime_options: Any
    ):
        """Initializes a RuntimeConfiguration object.

        Args:
            run_name: Optional name of the pipeline run.
            schedule: Optional schedule of the pipeline run.
            **runtime_options: Additional runtime options.
        """
        runtime_options[RUN_NAME_OPTION_KEY] = run_name
        runtime_options[SCHEDULE_OPTION_KEY] = schedule
        super().__init__(runtime_options)

    @property
    def run_name(self) -> Optional[str]:
        """Name of the pipeline run."""
        return cast(Optional[str], self[RUN_NAME_OPTION_KEY])

    @property
    def schedule(self) -> Optional["Schedule"]:
        """Schedule of the pipeline run."""
        from zenml.pipelines import Schedule

        return cast(Optional[Schedule], self[SCHEDULE_OPTION_KEY])

run_name: Optional[str] property readonly

Name of the pipeline run.

schedule: Optional[Schedule] property readonly

Schedule of the pipeline run.

__init__(self, *, run_name=None, schedule=None, **runtime_options) special

Initializes a RuntimeConfiguration object.

Parameters:

Name Type Description Default
run_name Optional[str]

Optional name of the pipeline run.

None
schedule Optional[Schedule]

Optional schedule of the pipeline run.

None
**runtime_options Any

Additional runtime options.

{}
Source code in zenml/runtime_configuration.py
def __init__(
    self,
    *,
    run_name: Optional[str] = None,
    schedule: Optional["Schedule"] = None,
    **runtime_options: Any
):
    """Initializes a RuntimeConfiguration object.

    Args:
        run_name: Optional name of the pipeline run.
        schedule: Optional schedule of the pipeline run.
        **runtime_options: Additional runtime options.
    """
    runtime_options[RUN_NAME_OPTION_KEY] = run_name
    runtime_options[SCHEDULE_OPTION_KEY] = schedule
    super().__init__(runtime_options)