Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster/dagster_tests/api_tests/api_tests_repo.py
import string | import string | ||||
from dagster import ( | from dagster import ( | ||||
InputDefinition, | InputDefinition, | ||||
Int, | Int, | ||||
OutputDefinition, | OutputDefinition, | ||||
PartitionSetDefinition, | PartitionSetDefinition, | ||||
ScheduleDefinition, | ScheduleDefinition, | ||||
lambda_solid, | lambda_solid, | ||||
pipeline, | pipeline, | ||||
repository, | repository, | ||||
solid, | solid, | ||||
usable_as_dagster_type, | usable_as_dagster_type, | ||||
) | ) | ||||
from dagster.core.definitions.decorators.sensor import sensor | |||||
@lambda_solid | @lambda_solid | ||||
def do_something(): | def do_something(): | ||||
return 1 | return 1 | ||||
@lambda_solid | @lambda_solid | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | return { | ||||
pipeline_name="baz", | pipeline_name="baz", | ||||
partition_fn=lambda: string.ascii_lowercase, | partition_fn=lambda: string.ascii_lowercase, | ||||
run_config_fn_for_partition=lambda partition: {}, | run_config_fn_for_partition=lambda partition: {}, | ||||
tags_fn_for_partition=error_partition_tags_fn, | tags_fn_for_partition=error_partition_tags_fn, | ||||
), | ), | ||||
} | } | ||||
@sensor(pipeline_name="foo_pipeline", run_config_fn=lambda _: {"foo": "FOO"}) | |||||
def sensor_foo(_): | |||||
return True | |||||
@sensor(pipeline_name="foo_pipeline") | |||||
def sensor_error(_): | |||||
raise Exception("womp womp") | |||||
@repository | @repository | ||||
def bar_repo(): | def bar_repo(): | ||||
return { | return { | ||||
"pipelines": { | "pipelines": { | ||||
"foo": define_foo_pipeline, | "foo": define_foo_pipeline, | ||||
"bar": lambda: bar_pipeline, | "bar": lambda: bar_pipeline, | ||||
"baz": lambda: baz_pipeline, | "baz": lambda: baz_pipeline, | ||||
}, | }, | ||||
"schedules": define_bar_schedules(), | "schedules": define_bar_schedules(), | ||||
"partition_sets": define_baz_partitions(), | "partition_sets": define_baz_partitions(), | ||||
"jobs": {"sensor_foo": sensor_foo, "sensor_error": lambda: sensor_error}, | |||||
} | } |