def test_submit_run(): with instance_for_test( overrides={ "run_coordinator": { "module": "dagster.core.test_utils", "class": "MockedRunCoordinator", } } ) as instance: with get_bar_workspace(instance) as workspace: external_pipeline = ( workspace.get_repository_location("bar_repo_location") .get_repository("bar_repo") .get_full_external_pipeline("foo") ) run = create_run_for_test( instance=instance, pipeline_name=external_pipeline.name, run_id="foo-bar", external_pipeline_origin=external_pipeline.get_external_origin(), pipeline_code_origin=external_pipeline.get_python_origin(), ) instance.submit_run(run.run_id, workspace) assert len(instance.run_coordinator.queue()) == 1 assert instance.run_coordinator.queue()[0].run_id == "foo-bar"
def test_submit_run_checks_status(instance, coodinator): # pylint: disable=redefined-outer-name with get_bar_workspace(instance) as workspace: external_pipeline = ( workspace.get_repository_location("bar_repo_location"). get_repository("bar_repo").get_full_external_pipeline("foo")) run = create_run(instance, external_pipeline, run_id="foo-1", status=PipelineRunStatus.STARTED) with pytest.raises(CheckError): coodinator.submit_run(SubmitRunContext(run, workspace))
def test_submit_run(instance, coodinator): # pylint: disable=redefined-outer-name with get_bar_workspace(instance) as workspace: external_pipeline = ( workspace.get_repository_location("bar_repo_location"). get_repository("bar_repo").get_full_external_pipeline("foo")) run = create_run(instance, external_pipeline, run_id="foo-1") returned_run = coodinator.submit_run(SubmitRunContext(run, workspace)) assert returned_run.run_id == "foo-1" assert returned_run.status == PipelineRunStatus.STARTING assert len(instance.run_launcher.queue()) == 1 assert instance.run_launcher.queue()[0].run_id == "foo-1" assert instance.run_launcher.queue( )[0].status == PipelineRunStatus.STARTING assert instance.get_run_by_id("foo-1")
def workspace_fixture(self, instance): with get_bar_workspace(instance) as workspace: yield workspace