def get_subset_external_pipeline(self, selector): check.inst_param(selector, "selector", PipelineSelector) # We have to grab the pipeline from the location instead of the repository directly # since we may have to request a subset we don't have in memory yet repository_location = self._repository_locations[ selector.location_name] external_repository = repository_location.get_repository( selector.repository_name) subset_result = repository_location.get_subset_external_pipeline_result( selector) if not subset_result.success: error_info = subset_result.error raise UserFacingGraphQLError( DauphinInvalidSubsetError( message="{message}{cause_message}".format( message=error_info.message, cause_message="\n{}".format(error_info.cause.message) if error_info.cause else "", ), pipeline=DauphinPipeline( self.get_full_external_pipeline(selector)), )) return ExternalPipeline( subset_result.external_pipeline_data, repository_handle=external_repository.handle, )
def get_external_pipeline_or_raise(graphene_info, selector): check.inst_param(graphene_info, "graphene_info", ResolveInfo) check.inst_param(selector, "selector", PipelineSelector) from dagster_graphql.schema.errors import DauphinInvalidSubsetError full_pipeline = get_full_external_pipeline_or_raise( graphene_info, selector) if selector.solid_selection is None: return full_pipeline for solid_name in selector.solid_selection: if not full_pipeline.has_solid_invocation(solid_name): raise UserFacingGraphQLError( DauphinInvalidSubsetError( message= 'Solid "{solid_name}" does not exist in "{pipeline_name}"'. format(solid_name=solid_name, pipeline_name=selector.pipeline_name), pipeline=graphene_info.schema.type_named("Pipeline")( full_pipeline), )) return graphene_info.context.get_subset_external_pipeline(selector)
def get_external_pipeline_subset_or_raise(graphene_info, pipeline_name, solid_subset): check.inst_param(graphene_info, 'graphene_info', ResolveInfo) check.str_param(pipeline_name, 'pipeline_name') check.opt_list_param(solid_subset, 'solid_subset', of_type=str) from dagster_graphql.schema.errors import DauphinInvalidSubsetError full_pipeline = get_external_pipeline_or_raise(graphene_info, pipeline_name) if solid_subset is None: return full_pipeline for solid_name in solid_subset: if not full_pipeline.has_solid_invocation(solid_name): raise UserFacingGraphQLError( DauphinInvalidSubsetError( message= 'Solid "{solid_name}" does not exist in "{pipeline_name}"'. format(solid_name=solid_name, pipeline_name=pipeline_name), pipeline=graphene_info.schema.type_named('Pipeline')( full_pipeline), )) try: return graphene_info.context.get_external_pipeline_subset( pipeline_name, solid_subset) except DagsterInvalidDefinitionError: # this handles the case when you construct a subset such that an unsatisfied # input cannot be hydrate from config. Current this is only relevant for # the in-process case. Once we add the out-of-process we will communicate # this error through the communication channel and change what exception # is thrown raise UserFacingGraphQLError( DauphinInvalidSubsetError( message=serializable_error_info_from_exc_info( sys.exc_info()).message, pipeline=graphene_info.schema.type_named('Pipeline')( full_pipeline), ))