Skip to content

get_dagster_config

kedro_dagster.config.models.get_dagster_config(context)

Get the Dagster configuration from the dagster.yml file.

Parameters

Name Type Description Default
context KedroContext

KedroContext that was created.

required

Returns

Type Description
KedroDagsterConfig

Dagster configuration.

See Also

kedro_dagster.config.models.KedroDagsterConfig : The configuration model returned.

Source Code

Show/Hide source
def get_dagster_config(context: "KedroContext") -> "KedroDagsterConfig":
    """Get the Dagster configuration from the ``dagster.yml`` file.

    Parameters
    ----------
    context : KedroContext
        ``KedroContext`` that was created.

    Returns
    -------
    KedroDagsterConfig
        Dagster configuration.

    See Also
    --------
    `kedro_dagster.config.models.KedroDagsterConfig` :
        The configuration model returned.
    """
    from kedro.config import MissingConfigException

    LOGGER.info("Loading Dagster configuration...")

    try:
        if "dagster" not in context.config_loader.config_patterns:
            context.config_loader.config_patterns.update({"dagster": ["dagster*", "dagster*/**", "**/dagster*"]})
        conf_dagster_yml = context.config_loader["dagster"]
    except MissingConfigException:
        LOGGER.warning(
            "No 'dagster.yml' config file found in environment. Default configuration will be used. "
            "Use ``kedro dagster init`` command in CLI to customize the configuration."
        )

        conf_dagster_yml = {}

    dagster_config = KedroDagsterConfig(**conf_dagster_yml)

    return dagster_config