Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster-graphql/dagster_graphql_tests/graphql/setup.py
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
) | ) | ||||
from dagster.cli.workspace import Workspace | from dagster.cli.workspace import Workspace | ||||
from dagster.core.definitions.decorators import executable | from dagster.core.definitions.decorators import executable | ||||
from dagster.core.definitions.partition import last_empty_partition | from dagster.core.definitions.partition import last_empty_partition | ||||
from dagster.core.definitions.reconstructable import ReconstructableRepository | from dagster.core.definitions.reconstructable import ReconstructableRepository | ||||
from dagster.core.host_representation import InProcessRepositoryLocation, RepositoryLocationHandle | from dagster.core.host_representation import InProcessRepositoryLocation, RepositoryLocationHandle | ||||
from dagster.core.log_manager import coerce_valid_log_level | from dagster.core.log_manager import coerce_valid_log_level | ||||
from dagster.core.storage.tags import RESUME_RETRY_TAG | from dagster.core.storage.tags import RESUME_RETRY_TAG | ||||
from dagster.core.test_utils import today_at_midnight | |||||
from dagster.utils import file_relative_path, segfault | from dagster.utils import file_relative_path, segfault | ||||
@dagster_type_loader(String) | @dagster_type_loader(String) | ||||
def df_input_schema(_context, path): | def df_input_schema(_context, path): | ||||
with open(path, "r") as fd: | with open(path, "r") as fd: | ||||
return [OrderedDict(sorted(x.items(), key=lambda x: x[0])) for x in csv.DictReader(fd)] | return [OrderedDict(sorted(x.items(), key=lambda x: x[0])) for x in csv.DictReader(fd)] | ||||
▲ Show 20 Lines • Show All 795 Lines • ▼ Show 20 Lines | def define_schedules(): | ||||
partition_based_custom_selector = integer_partition_set.create_schedule_definition( | partition_based_custom_selector = integer_partition_set.create_schedule_definition( | ||||
schedule_name="partition_based_custom_selector", | schedule_name="partition_based_custom_selector", | ||||
cron_schedule="0 0 * * *", | cron_schedule="0 0 * * *", | ||||
partition_selector=last_empty_partition, | partition_selector=last_empty_partition, | ||||
) | ) | ||||
@daily_schedule( | @daily_schedule( | ||||
pipeline_name="no_config_pipeline", | pipeline_name="no_config_pipeline", | ||||
start_date=datetime.datetime.now() - datetime.timedelta(days=1), | start_date=today_at_midnight() - datetime.timedelta(days=1), | ||||
execution_time=(datetime.datetime.now() + datetime.timedelta(hours=2)).time(), | execution_time=(datetime.datetime.now() + datetime.timedelta(hours=2)).time(), | ||||
) | ) | ||||
def partition_based_decorator(_date): | def partition_based_decorator(_date): | ||||
return {"storage": {"filesystem": {}}} | return {"storage": {"filesystem": {}}} | ||||
@daily_schedule( | @daily_schedule( | ||||
pipeline_name="multi_mode_with_loggers", | pipeline_name="multi_mode_with_loggers", | ||||
start_date=datetime.datetime.now() - datetime.timedelta(days=1), | start_date=today_at_midnight() - datetime.timedelta(days=1), | ||||
execution_time=(datetime.datetime.now() + datetime.timedelta(hours=2)).time(), | execution_time=(datetime.datetime.now() + datetime.timedelta(hours=2)).time(), | ||||
mode="foo_mode", | mode="foo_mode", | ||||
) | ) | ||||
def partition_based_multi_mode_decorator(_date): | def partition_based_multi_mode_decorator(_date): | ||||
return {"storage": {"filesystem": {}}} | return {"storage": {"filesystem": {}}} | ||||
@hourly_schedule( | @hourly_schedule( | ||||
pipeline_name="no_config_chain_pipeline", | pipeline_name="no_config_chain_pipeline", | ||||
start_date=datetime.datetime.now() - datetime.timedelta(days=1), | start_date=today_at_midnight() - datetime.timedelta(days=1), | ||||
execution_time=(datetime.datetime.now() + datetime.timedelta(hours=2)).time(), | execution_time=(datetime.datetime.now() + datetime.timedelta(hours=2)).time(), | ||||
solid_selection=["return_foo"], | solid_selection=["return_foo"], | ||||
) | ) | ||||
def solid_selection_hourly_decorator(_date): | def solid_selection_hourly_decorator(_date): | ||||
return {"storage": {"filesystem": {}}} | return {"storage": {"filesystem": {}}} | ||||
@daily_schedule( | @daily_schedule( | ||||
pipeline_name="no_config_chain_pipeline", | pipeline_name="no_config_chain_pipeline", | ||||
start_date=datetime.datetime.now() - datetime.timedelta(days=2), | start_date=today_at_midnight() - datetime.timedelta(days=2), | ||||
execution_time=(datetime.datetime.now() + datetime.timedelta(hours=3)).time(), | execution_time=(datetime.datetime.now() + datetime.timedelta(hours=3)).time(), | ||||
solid_selection=["return_foo"], | solid_selection=["return_foo"], | ||||
) | ) | ||||
def solid_selection_daily_decorator(_date): | def solid_selection_daily_decorator(_date): | ||||
return {"storage": {"filesystem": {}}} | return {"storage": {"filesystem": {}}} | ||||
@monthly_schedule( | @monthly_schedule( | ||||
pipeline_name="no_config_chain_pipeline", | pipeline_name="no_config_chain_pipeline", | ||||
start_date=datetime.datetime.now() - datetime.timedelta(days=100), | start_date=(today_at_midnight() - datetime.timedelta(days=100)).replace(day=1), | ||||
execution_time=(datetime.datetime.now() + datetime.timedelta(hours=4)).time(), | execution_time=(datetime.datetime.now() + datetime.timedelta(hours=4)).time(), | ||||
solid_selection=["return_foo"], | solid_selection=["return_foo"], | ||||
) | ) | ||||
def solid_selection_monthly_decorator(_date): | def solid_selection_monthly_decorator(_date): | ||||
return {"storage": {"filesystem": {}}} | return {"storage": {"filesystem": {}}} | ||||
@weekly_schedule( | @weekly_schedule( | ||||
pipeline_name="no_config_chain_pipeline", | pipeline_name="no_config_chain_pipeline", | ||||
start_date=datetime.datetime.now() - datetime.timedelta(days=50), | start_date=today_at_midnight() - datetime.timedelta(days=50), | ||||
execution_time=(datetime.datetime.now() + datetime.timedelta(hours=5)).time(), | execution_time=(datetime.datetime.now() + datetime.timedelta(hours=5)).time(), | ||||
solid_selection=["return_foo"], | solid_selection=["return_foo"], | ||||
) | ) | ||||
def solid_selection_weekly_decorator(_date): | def solid_selection_weekly_decorator(_date): | ||||
return {"storage": {"filesystem": {}}} | return {"storage": {"filesystem": {}}} | ||||
# Schedules for testing the user error boundary | # Schedules for testing the user error boundary | ||||
@daily_schedule( | @daily_schedule( | ||||
pipeline_name="no_config_pipeline", | pipeline_name="no_config_pipeline", | ||||
start_date=datetime.datetime.now() - datetime.timedelta(days=1), | start_date=today_at_midnight() - datetime.timedelta(days=1), | ||||
should_execute=lambda _: asdf, # pylint: disable=undefined-variable | should_execute=lambda _: asdf, # pylint: disable=undefined-variable | ||||
) | ) | ||||
def should_execute_error_schedule(_date): | def should_execute_error_schedule(_date): | ||||
return {"storage": {"filesystem": {}}} | return {"storage": {"filesystem": {}}} | ||||
@daily_schedule( | @daily_schedule( | ||||
pipeline_name="no_config_pipeline", | pipeline_name="no_config_pipeline", | ||||
start_date=datetime.datetime.now() - datetime.timedelta(days=1), | start_date=today_at_midnight() - datetime.timedelta(days=1), | ||||
tags_fn_for_date=lambda _: asdf, # pylint: disable=undefined-variable | tags_fn_for_date=lambda _: asdf, # pylint: disable=undefined-variable | ||||
) | ) | ||||
def tags_error_schedule(_date): | def tags_error_schedule(_date): | ||||
return {"storage": {"filesystem": {}}} | return {"storage": {"filesystem": {}}} | ||||
@daily_schedule( | @daily_schedule( | ||||
pipeline_name="no_config_pipeline", | pipeline_name="no_config_pipeline", | ||||
start_date=datetime.datetime.now() - datetime.timedelta(days=1), | start_date=today_at_midnight() - datetime.timedelta(days=1), | ||||
) | ) | ||||
def run_config_error_schedule(_date): | def run_config_error_schedule(_date): | ||||
return asdf # pylint: disable=undefined-variable | return asdf # pylint: disable=undefined-variable | ||||
tagged_pipeline_schedule = ScheduleDefinition( | tagged_pipeline_schedule = ScheduleDefinition( | ||||
name="tagged_pipeline_schedule", | name="tagged_pipeline_schedule", | ||||
cron_schedule="0 0 * * *", | cron_schedule="0 0 * * *", | ||||
pipeline_name="tagged_pipeline", | pipeline_name="tagged_pipeline", | ||||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |