def _readonly_in_memory_instance(): with seven.TemporaryDirectory() as temp_dir: yield DagsterInstance( instance_type=InstanceType.EPHEMERAL, local_artifact_storage=LocalArtifactStorage(temp_dir), run_storage=InMemoryRunStorage(), event_storage=InMemoryEventLogStorage(), compute_log_manager=LocalComputeLogManager(temp_dir), run_launcher=ExplodingRunLauncher(), schedule_storage=SqliteScheduleStorage.from_local(temp_dir), )
def _in_memory_instance(): with tempfile.TemporaryDirectory() as temp_dir: yield DagsterInstance( instance_type=InstanceType.EPHEMERAL, local_artifact_storage=LocalArtifactStorage(temp_dir), run_storage=InMemoryRunStorage(), event_storage=InMemoryEventLogStorage(), compute_log_manager=LocalComputeLogManager(temp_dir), run_launcher=SyncInMemoryRunLauncher(), run_coordinator=DefaultRunCoordinator(), schedule_storage=SqliteScheduleStorage.from_local(temp_dir), )
def test_schedules(): with seven.TemporaryDirectory() as temp_dir: instance = DagsterInstance.local_temp(temp_dir) # Patch scheduler and schedule storage. instance._schedule_storage = SqliteScheduleStorage.from_local( # pylint: disable=protected-access temp_dir ) instance._scheduler = FilesystemTestScheduler(temp_dir) # pylint: disable=protected-access context = define_context_for_repository_yaml( path=file_relative_path(__file__, '../repository.yaml'), instance=instance ) repository = context.legacy_get_repository_definition() instance.reconcile_scheduler_state( python_path=sys.executable, repository_path=file_relative_path(__file__, '../'), repository=repository, ) for schedule_name in [ 'many_events_every_min', 'pandas_hello_world_hourly', ]: result = execute_dagster_graphql( context, LAUNCH_SCHEDULED_EXECUTION_MUTATION, variables={'scheduleName': schedule_name}, ) assert not result.errors assert result.data assert ( result.data['launchScheduledExecution']['__typename'] == 'LaunchPipelineRunSuccess' )