Пример #1
0
def define_scheduler_instance(tempdir):
    return DagsterInstance(
        instance_type=InstanceType.EPHEMERAL,
        local_artifact_storage=LocalArtifactStorage(tempdir),
        run_storage=InMemoryRunStorage(),
        event_storage=InMemoryEventLogStorage(),
        compute_log_manager=NoOpComputeLogManager(tempdir),
        schedule_storage=SqliteScheduleStorage.from_local(os.path.join(tempdir, 'schedules')),
        scheduler=SystemCronScheduler(os.path.join(tempdir, 'schedules')),
    )
Пример #2
0
def define_scheduler_instance(tempdir):
    with pytest.warns(UserWarning, match="`SystemCronScheduler` is deprecated"):
        return DagsterInstance(
            instance_type=InstanceType.EPHEMERAL,
            local_artifact_storage=LocalArtifactStorage(tempdir),
            run_storage=InMemoryRunStorage(),
            event_storage=InMemoryEventLogStorage(),
            compute_log_manager=NoOpComputeLogManager(),
            schedule_storage=SqliteScheduleStorage.from_local(os.path.join(tempdir, "schedules")),
            scheduler=SystemCronScheduler(),
            run_coordinator=DefaultRunCoordinator(),
            run_launcher=SyncInMemoryRunLauncher(),
        )
Пример #3
0
def define_scheduler(artifacts_dir):
    many_events_every_minute = ScheduleDefinition(
        name="many_events_every_min",
        cron_schedule="* * * * *",
        execution_params={
            "environmentConfigData": {
                "storage": {
                    "filesystem": {}
                }
            },
            "selector": {
                "name": "many_events",
                "solidSubset": None
            },
            "mode": "default",
        },
    )

    log_spew_hourly = ScheduleDefinition(
        name="log_spew_hourly",
        cron_schedule="0 * * * *",
        execution_params={
            "environmentConfigData": {
                "storage": {
                    "filesystem": {}
                }
            },
            "selector": {
                "name": "log_spew",
                "solidSubset": None
            },
            "mode": "default",
        },
    )

    pandas_hello_world_hourly = ScheduleDefinition(
        name="pandas_hello_world_hourly",
        cron_schedule="0 * * * *",
        execution_params={
            "environmentConfigData": {
                "solids": {
                    "sum_solid": {
                        "inputs": {
                            "num": {
                                "csv": {
                                    "path":
                                    file_relative_path(
                                        __file__,
                                        "../pandas_hello_world/data/num.csv")
                                }
                            }
                        }
                    }
                }
            },
            "selector": {
                "name": "pandas_hello_world",
                "solidSubset": None
            },
            "mode": "default",
        },
    )

    return SystemCronScheduler(
        schedule_defs=[
            many_events_every_minute, log_spew_hourly,
            pandas_hello_world_hourly
        ],
        artifacts_dir=artifacts_dir,
    )