Exemple #1
0
def test_launch_run_with_unloadable_pipeline_grpc():
    with instance_for_test() as instance:
        with get_bar_repo_repository_location() as repository_location:
            pipeline_handle = PipelineHandle(
                "foo",
                repository_location.get_repository("bar_repo").handle)
            api_client = repository_location.client

            pipeline_run = instance.create_run(
                pipeline_name="foo",
                run_id=None,
                run_config={},
                mode="default",
                solids_to_execute=None,
                step_keys_to_execute=None,
                status=None,
                tags=None,
                root_run_id=None,
                parent_run_id=None,
                pipeline_snapshot=None,
                execution_plan_snapshot=None,
                parent_pipeline_snapshot=None,
            )
            run_id = pipeline_run.run_id

            original_origin = pipeline_handle.get_external_origin()

            # point the api to a pipeline that cannot be loaded
            res = deserialize_json_to_dagster_namedtuple(
                api_client.start_run(
                    ExecuteExternalPipelineArgs(
                        pipeline_origin=original_origin._replace(
                            pipeline_name="i_am_fake_pipeline"),
                        pipeline_run_id=run_id,
                        instance_ref=instance.get_ref(),
                    )))

            assert res.success
            finished_pipeline_run = poll_for_finished_run(instance, run_id)

            assert finished_pipeline_run
            assert finished_pipeline_run.run_id == run_id
            assert finished_pipeline_run.status == PipelineRunStatus.FAILURE

            poll_for_event(instance,
                           run_id,
                           event_type="ENGINE_EVENT",
                           message="Process for run exited")
            event_records = instance.all_logs(run_id)
            _check_event_log_contains(
                event_records,
                [
                    ("ENGINE_EVENT", "Started process for run"),
                    ("ENGINE_EVENT", "Could not load pipeline definition"),
                    (
                        "PIPELINE_FAILURE",
                        "This run has been marked as failed from outside the execution context",
                    ),
                    ("ENGINE_EVENT", "Process for run exited"),
                ],
            )
Exemple #2
0
def get_foo_pipeline_handle():
    return PipelineHandle('foo', get_bar_repo_handle())
Exemple #3
0
def legacy_get_foo_pipeline_handle():
    return PipelineHandle('foo', legacy_get_bar_repo_handle())
Exemple #4
0
def get_foo_grpc_pipeline_handle():
    with get_bar_grpc_repo_handle() as repo_handle:
        yield PipelineHandle("foo", repo_handle)