def test_execution_plan_error_api():
    pipeline_handle = get_foo_pipeline_handle()

    with pytest.raises(
        DagsterSubprocessError, match=re.escape('Could not find mode made_up_mode in pipeline foo')
    ):
        sync_get_external_execution_plan(
            pipeline_handle.get_origin(),
            run_config={},
            mode='made_up_mode',
            pipeline_snapshot_id='12345',
        )
Example #2
0
    def get_external_execution_plan(self, external_pipeline, run_config, mode,
                                    step_keys_to_execute):
        from dagster.api.snapshot_execution_plan import sync_get_external_execution_plan

        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(
            pipeline_origin=external_pipeline.get_origin(),
            solid_selection=external_pipeline.solid_selection,
            run_config=run_config,
            mode=mode,
            step_keys_to_execute=step_keys_to_execute,
            pipeline_snapshot_id=external_pipeline.
            identifying_pipeline_snapshot_id,
        )

        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,
        )
Example #3
0
def test_execution_plan_with_subset_snapshot_api():
    pipeline_handle = get_foo_pipeline_handle()

    execution_plan_snapshot = sync_get_external_execution_plan(
        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
Example #4
0
    def get_external_execution_plan(self, external_pipeline, environment_dict,
                                    mode, step_keys_to_execute):
        from dagster.api.snapshot_execution_plan import sync_get_external_execution_plan

        check.inst_param(external_pipeline, 'external_pipeline',
                         ExternalPipeline)
        check.dict_param(environment_dict, 'environment_dict')
        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(
            pipeline_origin=external_pipeline.get_origin(),
            solid_selection=external_pipeline.solid_selection,
            environment_dict=environment_dict,
            mode=mode,
            step_keys_to_execute=step_keys_to_execute,
            snapshot_id=external_pipeline.identifying_pipeline_snapshot_id,
        )

        return ExternalExecutionPlan(
            execution_plan_snapshot=execution_plan_snapshot,
            represented_pipeline=external_pipeline,
        )
def test_execution_plan_snapshot_api():
    pipeline_handle = get_foo_pipeline_handle()

    execution_plan_snapshot = sync_get_external_execution_plan(
        pipeline_handle.get_origin(), run_config={}, mode="default", pipeline_snapshot_id="12345",
    )

    assert isinstance(execution_plan_snapshot, ExecutionPlanSnapshot)
    assert execution_plan_snapshot.step_keys_to_execute == [
        'do_something.compute',
        'do_input.compute',
    ]
    assert len(execution_plan_snapshot.steps) == 2
def test_execution_plan_with_step_keys_to_execute_snapshot_api():
    pipeline_handle = get_foo_pipeline_handle()

    execution_plan_snapshot = sync_get_external_execution_plan(
        pipeline_handle,
        environment_dict={},
        mode="default",
        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