def test_execution_plan_error_grpc():
    pipeline_handle = get_foo_grpc_pipeline_handle()
    api_client = pipeline_handle.repository_handle.repository_location_handle.client

    with pytest.raises(
        DagsterSubprocessError, match=re.escape('Could not find mode made_up_mode in pipeline foo')
    ):
        sync_get_external_execution_plan_grpc(
            api_client,
            pipeline_handle.get_origin(),
            run_config={},
            mode='made_up_mode',
            pipeline_snapshot_id='12345',
        )
def test_execution_plan_error_grpc():
    with get_foo_pipeline_handle() as pipeline_handle:
        api_client = pipeline_handle.repository_handle.repository_location.client

        with pytest.raises(
            DagsterSubprocessError,
            match=re.escape("Could not find mode made_up_mode in pipeline foo"),
        ):
            sync_get_external_execution_plan_grpc(
                api_client,
                pipeline_handle.get_external_origin(),
                run_config={},
                mode="made_up_mode",
                pipeline_snapshot_id="12345",
            )
    def get_external_execution_plan(
        self, external_pipeline, run_config, mode, step_keys_to_execute
    ):
        check.inst_param(external_pipeline, "external_pipeline", ExternalPipeline)
        check.dict_param(run_config, "run_config")
        check.str_param(mode, "mode")
        check.opt_list_param(step_keys_to_execute, "step_keys_to_execute", of_type=str)

        execution_plan_snapshot_or_error = sync_get_external_execution_plan_grpc(
            api_client=self._handle.client,
            pipeline_origin=external_pipeline.get_external_origin(),
            run_config=run_config,
            mode=mode,
            pipeline_snapshot_id=external_pipeline.identifying_pipeline_snapshot_id,
            solid_selection=external_pipeline.solid_selection,
            step_keys_to_execute=step_keys_to_execute,
        )

        if isinstance(execution_plan_snapshot_or_error, ExecutionPlanSnapshotErrorData):
            return execution_plan_snapshot_or_error

        return ExternalExecutionPlan(
            execution_plan_snapshot=execution_plan_snapshot_or_error,
            represented_pipeline=external_pipeline,
        )
    def get_external_execution_plan(
        self,
        external_pipeline: ExternalPipeline,
        run_config: Dict[str, Any],
        mode: str,
        step_keys_to_execute: Optional[List[str]],
        known_state: Optional[KnownExecutionState],
    ) -> ExternalExecutionPlan:
        check.inst_param(external_pipeline, "external_pipeline",
                         ExternalPipeline)
        check.dict_param(run_config, "run_config")
        check.str_param(mode, "mode")
        check.opt_list_param(step_keys_to_execute,
                             "step_keys_to_execute",
                             of_type=str)
        check.opt_inst_param(known_state, "known_state", KnownExecutionState)

        execution_plan_snapshot_or_error = sync_get_external_execution_plan_grpc(
            api_client=self.client,
            pipeline_origin=external_pipeline.get_external_origin(),
            run_config=run_config,
            mode=mode,
            pipeline_snapshot_id=external_pipeline.
            identifying_pipeline_snapshot_id,
            solid_selection=external_pipeline.solid_selection,
            step_keys_to_execute=step_keys_to_execute,
            known_state=known_state,
        )

        return ExternalExecutionPlan(
            execution_plan_snapshot=execution_plan_snapshot_or_error,
            represented_pipeline=external_pipeline,
        )
Beispiel #5
0
    def get_external_execution_plan(self, external_pipeline, run_config, mode,
                                    step_keys_to_execute):
        check.inst_param(external_pipeline, 'external_pipeline',
                         ExternalPipeline)
        check.dict_param(run_config, 'run_config')
        check.str_param(mode, 'mode')
        check.opt_list_param(step_keys_to_execute,
                             'step_keys_to_execute',
                             of_type=str)

        execution_plan_snapshot = sync_get_external_execution_plan_grpc(
            api_client=self._handle.client,
            pipeline_origin=external_pipeline.get_origin(),
            run_config=run_config,
            mode=mode,
            pipeline_snapshot_id=external_pipeline.
            identifying_pipeline_snapshot_id,
            solid_selection=external_pipeline.solid_selection,
            step_keys_to_execute=step_keys_to_execute,
        )

        return ExternalExecutionPlan(
            execution_plan_snapshot=execution_plan_snapshot,
            represented_pipeline=external_pipeline,
        )
def test_execution_plan_with_subset_snapshot_api_grpc():
    with get_foo_grpc_pipeline_handle() as pipeline_handle:
        api_client = pipeline_handle.repository_handle.repository_location_handle.client

        execution_plan_snapshot = sync_get_external_execution_plan_grpc(
            api_client,
            pipeline_handle.get_external_origin(),
            run_config={
                "solids": {
                    "do_input": {
                        "inputs": {
                            "x": {
                                "value": "test"
                            }
                        }
                    }
                }
            },
            mode="default",
            pipeline_snapshot_id="12345",
            solid_selection=["do_input"],
        )

        assert isinstance(execution_plan_snapshot, ExecutionPlanSnapshot)
        assert execution_plan_snapshot.step_keys_to_execute == [
            "do_input",
        ]
        assert len(execution_plan_snapshot.steps) == 1
Beispiel #7
0
def test_execution_plan_with_subset_snapshot_api_grpc():
    pipeline_handle = get_foo_pipeline_handle()

    execution_plan_snapshot = sync_get_external_execution_plan_grpc(
        pipeline_handle.get_origin(),
        run_config={
            'solids': {
                'do_input': {
                    'inputs': {
                        'x': {
                            'value': "test"
                        }
                    }
                }
            }
        },
        mode="default",
        pipeline_snapshot_id="12345",
        solid_selection=["do_input"],
    )

    assert isinstance(execution_plan_snapshot, ExecutionPlanSnapshot)
    assert execution_plan_snapshot.step_keys_to_execute == [
        'do_input.compute',
    ]
    assert len(execution_plan_snapshot.steps) == 1
def test_execution_plan_error_grpc(instance):
    with get_bar_repo_repository_location(instance) as repository_location:
        pipeline_handle = PipelineHandle(
            "foo", repository_location.get_repository("bar_repo").handle
        )
        api_client = repository_location.client

        with pytest.raises(
            DagsterUserCodeProcessError,
            match=re.escape("Could not find mode made_up_mode in pipeline foo"),
        ):
            sync_get_external_execution_plan_grpc(
                api_client,
                pipeline_handle.get_external_origin(),
                run_config={},
                mode="made_up_mode",
                pipeline_snapshot_id="12345",
            )
Beispiel #9
0
def test_execution_plan_with_step_keys_to_execute_snapshot_api_grpc():
    pipeline_handle = get_foo_pipeline_handle()

    execution_plan_snapshot = sync_get_external_execution_plan_grpc(
        pipeline_handle.get_origin(),
        run_config={},
        mode="default",
        pipeline_snapshot_id="12345",
        step_keys_to_execute=['do_something.compute'],
    )

    assert isinstance(execution_plan_snapshot, ExecutionPlanSnapshot)
    assert execution_plan_snapshot.step_keys_to_execute == [
        'do_something.compute',
    ]
    assert len(execution_plan_snapshot.steps) == 2
def test_execution_plan_with_step_keys_to_execute_snapshot_api_grpc():
    with get_foo_grpc_pipeline_handle() as pipeline_handle:
        api_client = pipeline_handle.repository_handle.repository_location_handle.client

        execution_plan_snapshot = sync_get_external_execution_plan_grpc(
            api_client,
            pipeline_handle.get_external_origin(),
            run_config={},
            mode="default",
            pipeline_snapshot_id="12345",
            step_keys_to_execute=["do_something"],
        )

        assert isinstance(execution_plan_snapshot, ExecutionPlanSnapshot)
        assert execution_plan_snapshot.step_keys_to_execute == [
            "do_something",
        ]
        assert len(execution_plan_snapshot.steps) == 2
def test_execution_plan_with_subset_snapshot_api_grpc(instance):
    with get_bar_repo_repository_location(instance) as repository_location:
        pipeline_handle = PipelineHandle(
            "foo", repository_location.get_repository("bar_repo").handle
        )
        api_client = repository_location.client

        execution_plan_snapshot = sync_get_external_execution_plan_grpc(
            api_client,
            pipeline_handle.get_external_origin(),
            run_config={"solids": {"do_input": {"inputs": {"x": {"value": "test"}}}}},
            mode="default",
            pipeline_snapshot_id="12345",
            solid_selection=["do_input"],
        )

        assert isinstance(execution_plan_snapshot, ExecutionPlanSnapshot)
        assert execution_plan_snapshot.step_keys_to_execute == [
            "do_input",
        ]
        assert len(execution_plan_snapshot.steps) == 1
def test_execution_plan_with_step_keys_to_execute_snapshot_api_grpc(instance):
    with get_bar_repo_repository_location(instance) as repository_location:
        pipeline_handle = PipelineHandle(
            "foo", repository_location.get_repository("bar_repo").handle
        )
        api_client = repository_location.client

        execution_plan_snapshot = sync_get_external_execution_plan_grpc(
            api_client,
            pipeline_handle.get_external_origin(),
            run_config={},
            mode="default",
            pipeline_snapshot_id="12345",
            step_keys_to_execute=["do_something"],
        )

        assert isinstance(execution_plan_snapshot, ExecutionPlanSnapshot)
        assert execution_plan_snapshot.step_keys_to_execute == [
            "do_something",
        ]
        assert len(execution_plan_snapshot.steps) == 2