Skip to content

resolve_schedule

kedro_azureml_pipeline.scheduler.resolve_schedule(schedule_ref, named_schedules)

Resolve a schedule reference to a ScheduleConfig.

If schedule_ref is already a ScheduleConfig it is returned as-is. If it is a string, it is looked up in named_schedules.

Parameters

Name Type Description Default
schedule_ref ScheduleConfig or str

Inline config or a named schedule key.

required
named_schedules dict of str to ScheduleConfig or None

Named schedules from the schedules section of azureml.yml.

required

Returns

Type Description
ScheduleConfig

Resolved schedule configuration.

Raises

Type Description
KeyError

If schedule_ref is a string not found in named_schedules.

See Also

ScheduleConfig : The resolved configuration type. build_trigger : Next step after resolving.

Source Code

Show/Hide source
def resolve_schedule(
    schedule_ref: ScheduleConfig | str,
    named_schedules: dict[str, ScheduleConfig] | None,
) -> ScheduleConfig:
    """Resolve a schedule reference to a ``ScheduleConfig``.

    If *schedule_ref* is already a ``ScheduleConfig`` it is returned
    as-is. If it is a string, it is looked up in *named_schedules*.

    Parameters
    ----------
    schedule_ref : ScheduleConfig or str
        Inline config or a named schedule key.
    named_schedules : dict of str to ScheduleConfig or None
        Named schedules from the ``schedules`` section of ``azureml.yml``.

    Returns
    -------
    ScheduleConfig
        Resolved schedule configuration.

    Raises
    ------
    KeyError
        If *schedule_ref* is a string not found in *named_schedules*.

    See Also
    --------
    [ScheduleConfig][kedro_azureml_pipeline.config.ScheduleConfig] : The resolved configuration type.
    [build_trigger][kedro_azureml_pipeline.scheduler.build_trigger] : Next step after resolving.
    """
    if isinstance(schedule_ref, ScheduleConfig):
        return schedule_ref
    if named_schedules is None or schedule_ref not in named_schedules:
        raise KeyError(f"Schedule '{schedule_ref}' not found in the 'schedules' section of azureml.yml")
    return named_schedules[schedule_ref]