Пример #1
0
 def resolve_runConfigSchemaOrError(self, graphene_info, **kwargs):
     return resolve_run_config_schema_or_error(
         graphene_info,
         pipeline_selector_from_graphql(graphene_info.context,
                                        kwargs['selector']),
         kwargs.get('mode'),
     )
Пример #2
0
 def resolve_isPipelineConfigValid(self, graphene_info, pipeline, **kwargs):
     return validate_pipeline_config(
         graphene_info,
         pipeline_selector_from_graphql(graphene_info.context, pipeline),
         kwargs.get('runConfigData'),
         kwargs.get('mode'),
     )
Пример #3
0
 def resolve_executionPlanOrError(self, graphene_info, pipeline, **kwargs):
     return get_execution_plan(
         graphene_info,
         pipeline_selector_from_graphql(graphene_info.context, pipeline),
         kwargs.get('runConfigData'),
         kwargs.get('mode'),
     )
Пример #4
0
def execution_params_from_graphql(context, graphql_execution_params):
    return ExecutionParams(
        selector=pipeline_selector_from_graphql(
            context, graphql_execution_params.get('selector')),
        run_config=graphql_execution_params.get('runConfigData') or {},
        mode=graphql_execution_params.get('mode'),
        execution_metadata=create_execution_metadata(
            graphql_execution_params.get('executionMetadata')),
        step_keys=graphql_execution_params.get('stepKeys'),
    )
Пример #5
0
def execution_params_from_graphql(context, graphql_execution_params):
    return ExecutionParams(
        selector=pipeline_selector_from_graphql(
            context, graphql_execution_params.get("selector")),
        run_config=graphql_execution_params.get("runConfigData") or {},
        mode=graphql_execution_params.get("mode"),
        execution_metadata=create_execution_metadata(
            graphql_execution_params.get("executionMetadata")),
        step_keys=graphql_execution_params.get("stepKeys"),
    )
Пример #6
0
def create_execution_params(graphene_info, graphql_execution_params):
    preset_name = graphql_execution_params.get('preset')
    selector = pipeline_selector_from_graphql(
        graphene_info.context, graphql_execution_params['selector']
    )
    if preset_name:
        if graphql_execution_params.get('runConfigData'):
            raise UserFacingGraphQLError(
                graphene_info.schema.type_named('ConflictingExecutionParamsError')(
                    conflicting_param='runConfigData'
                )
            )

        if graphql_execution_params.get('mode'):
            raise UserFacingGraphQLError(
                graphene_info.schema.type_named('ConflictingExecutionParamsError')(
                    conflicting_param='mode'
                )
            )

        if selector.solid_selection:
            raise UserFacingGraphQLError(
                graphene_info.schema.type_named('ConflictingExecutionParamsError')(
                    conflicting_param='selector.solid_selection'
                )
            )

        external_pipeline = get_full_external_pipeline_or_raise(graphene_info, selector)

        if not external_pipeline.has_preset(preset_name):
            raise UserFacingGraphQLError(
                graphene_info.schema.type_named('PresetNotFoundError')(
                    preset=preset_name, selector=selector
                )
            )

        preset = external_pipeline.get_preset(preset_name)

        return ExecutionParams(
            selector=selector.with_solid_selection(preset.solid_selection),
            run_config=preset.run_config,
            mode=preset.mode,
            execution_metadata=create_execution_metadata(
                graphql_execution_params.get('executionMetadata')
            ),
            step_keys=graphql_execution_params.get('stepKeys'),
        )

    return execution_params_from_graphql(graphene_info.context, graphql_execution_params)
Пример #7
0
def create_execution_params(graphene_info, graphql_execution_params):

    preset_name = graphql_execution_params.get('preset')
    selector = pipeline_selector_from_graphql(
        graphene_info.context, graphql_execution_params['selector'])
    if preset_name:
        # This should return proper GraphQL errors
        # https://github.com/dagster-io/dagster/issues/2507
        check.invariant(
            not graphql_execution_params.get('runConfigData'),
            'Invalid ExecutionParams. Cannot define environment_dict when using preset',
        )
        check.invariant(
            not graphql_execution_params.get('mode'),
            'Invalid ExecutionParams. Cannot define mode when using preset',
        )

        check.invariant(
            not selector.solid_selection,
            'Invalid ExecutionParams. Cannot define selector.solid_selection when using preset',
        )

        external_pipeline = get_full_external_pipeline_or_raise(
            graphene_info, selector)

        if not external_pipeline.has_preset(preset_name):
            raise UserFacingGraphQLError(
                graphene_info.schema.type_named('PresetNotFoundError')(
                    preset=preset_name, selector=selector))

        preset = external_pipeline.get_preset(preset_name)

        return ExecutionParams(
            selector=selector.with_solid_selection(preset.solid_selection),
            environment_dict=preset.environment_dict,
            mode=preset.mode,
            execution_metadata=create_execution_metadata(
                graphql_execution_params.get('executionMetadata')),
            step_keys=graphql_execution_params.get('stepKeys'),
        )

    return execution_params_from_graphql(graphene_info.context,
                                         graphql_execution_params)
Пример #8
0
    def resolve_pipelineSnapshotOrError(self, graphene_info, **kwargs):
        snapshot_id_arg = kwargs.get('snapshotId')
        pipeline_selector_arg = kwargs.get('activePipelineSelector')
        check.invariant(
            not (snapshot_id_arg and pipeline_selector_arg),
            'Must only pass one of snapshotId or activePipelineSelector',
        )
        check.invariant(
            snapshot_id_arg or pipeline_selector_arg,
            'Must set one of snapshotId or activePipelineSelector',
        )

        if pipeline_selector_arg:
            pipeline_selector = pipeline_selector_from_graphql(
                graphene_info.context, kwargs['activePipelineSelector'])
            return get_pipeline_snapshot_or_error_from_pipeline_selector(
                graphene_info, pipeline_selector)
        else:
            return get_pipeline_snapshot_or_error_from_snapshot_id(
                graphene_info, snapshot_id_arg)
Пример #9
0
 def resolve_pipelineOrError(self, graphene_info, **kwargs):
     return get_pipeline_or_error(
         graphene_info,
         pipeline_selector_from_graphql(graphene_info.context,
                                        kwargs['params']),
     )