def _resolve_solid_selection(self, solid_selection): # resolve a list of solid selection queries to a frozenset of qualified solid names # e.g. ['foo_solid+'] to {'foo_solid', 'bar_solid'} check.list_param(solid_selection, "solid_selection", of_type=str) solids_to_execute = parse_solid_selection(self.get_definition(), solid_selection) if len(solids_to_execute) == 0: raise DagsterInvalidSubsetError( "No qualified solids to execute found for solid_selection={requested}" .format(requested=solid_selection)) return solids_to_execute
def _subset_for_execution( self, solids_to_execute: Optional[Optional[FrozenSet[str]]], solid_selection: Optional[List[str]], ) -> "ReconstructablePipeline": # no selection if solid_selection is None and solids_to_execute is None: return ReconstructablePipeline( repository=self.repository, pipeline_name=self.pipeline_name, ) from dagster.core.definitions import JobDefinition, PipelineDefinition pipeline_def = self.get_definition() if isinstance(pipeline_def, JobDefinition): # when subselecting a job # * job subselection depend on solid_selection rather than solids_to_execute # * we'll resolve the op selection later in the stack if solid_selection is None: # when the pre-resolution info is unavailable (e.g. subset from existing run), # we need to fill the solid_selection in order to pass the value down to deeper stack. solid_selection = list( solids_to_execute) if solids_to_execute else None return ReconstructablePipeline( repository=self.repository, pipeline_name=self.pipeline_name, solid_selection_str=seven.json.dumps(solid_selection), solids_to_execute=None, ) elif isinstance(pipeline_def, PipelineDefinition): # when subselecting a pipeline # * pipeline subselection depend on solids_to_excute rather than solid_selection # * we resolve a list of solid selection queries to a frozenset of qualified solid names # e.g. ['foo_solid+'] to {'foo_solid', 'bar_solid'} if solid_selection and solids_to_execute is None: # when post-resolution query is unavailable, resolve the query solids_to_execute = parse_solid_selection( pipeline_def, solid_selection) return ReconstructablePipeline( repository=self.repository, pipeline_name=self.pipeline_name, solid_selection_str=seven.json.dumps(solid_selection) if solid_selection else None, solids_to_execute=frozenset(solids_to_execute) if solids_to_execute else None, ) else: raise Exception( f"Unexpected pipeline/job type {pipeline_def.__class__.__name__}" )
def _resolve_solid_selection(self, solid_selection): # resolve a list of solid selection queries to a frozenset of qualified solid names # e.g. ['foo_solid+'] to {'foo_solid', 'bar_solid'} check.list_param(solid_selection, "solid_selection", of_type=str) solids_to_execute = parse_solid_selection(self.get_definition(), solid_selection) if len(solids_to_execute) == 0: node_type = "ops" if self._pipeline_def.is_job else "solids" selection_type = "op_selection" if self._pipeline_def.is_job else "solid_selection" raise DagsterInvalidSubsetError( "No qualified {node_type} to execute found for {selection_type}={requested}".format( node_type=node_type, requested=solid_selection, selection_type=selection_type ) ) return solids_to_execute