Differential D8684 Diff 40807 examples/docs_snippets/docs_snippets/concepts/repositories_workspaces/lazy_repository_definition.py
Changeset View
Changeset View
Standalone View
Standalone View
examples/docs_snippets/docs_snippets/concepts/repositories_workspaces/lazy_repository_definition.py
# pylint: disable=unused-argument | # pylint: disable=unused-argument | ||||
import datetime | import datetime | ||||
from dagster import InputDefinition, RunRequest, daily_schedule, pipeline, repository, sensor, solid | from dagster import ( | ||||
InputDefinition, | |||||
RunRequest, | |||||
daily_schedule, | |||||
pipeline, | |||||
repository, | |||||
sensor, | |||||
solid, | |||||
) | |||||
@solid | @solid | ||||
def return_one(): | def return_one(): | ||||
return 1 | return 1 | ||||
@solid | @solid | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | def my_lazy_repository(): | ||||
# Note that we can pass a dict of functions, rather than a list of | # Note that we can pass a dict of functions, rather than a list of | ||||
# pipeline definitions. This allows us to construct pipelines lazily, | # pipeline definitions. This allows us to construct pipelines lazily, | ||||
# if, e.g., initializing a pipeline involves any heavy compute | # if, e.g., initializing a pipeline involves any heavy compute | ||||
return { | return { | ||||
"pipelines": { | "pipelines": { | ||||
"addition_pipeline": load_addition_pipeline, | "addition_pipeline": load_addition_pipeline, | ||||
"subtraction_pipeline": load_subtraction_pipeline, | "subtraction_pipeline": load_subtraction_pipeline, | ||||
}, | }, | ||||
"schedules": {"daily_addition_schedule": load_daily_addition_schedule}, | "schedules": { | ||||
"daily_addition_schedule": load_daily_addition_schedule | |||||
}, | |||||
"sensors": {"addition_sensor": load_addition_sensor}, | "sensors": {"addition_sensor": load_addition_sensor}, | ||||
} | } | ||||
# end_lazy_repository_definition_marker_0 | # end_lazy_repository_definition_marker_0 |