示例#1
0
    def resolve_executionPlan(self, graphene_info):
        if (self._pipeline_run.execution_plan_snapshot_id
                and self._pipeline_run.pipeline_snapshot_id):
            from .execution import DauphinExecutionPlan

            instance = graphene_info.context.instance
            execution_plan_snapshot = instance.get_execution_plan_snapshot(
                self._pipeline_run.execution_plan_snapshot_id)
            pipeline_snapshot = instance.get_pipeline_snapshot(
                self._pipeline_run.pipeline_snapshot_id)
            return (DauphinExecutionPlan(
                ExecutionPlanIndex(
                    execution_plan_snapshot=execution_plan_snapshot,
                    pipeline_index=PipelineIndex(pipeline_snapshot),
                ))
                    # check this in case fetches fail
                    if execution_plan_snapshot and pipeline_snapshot else None)
        else:
            # "legacy" code path for runs created before pipeline and
            # execution plan snapshots.
            pipeline = self.resolve_pipeline(graphene_info)

            if isinstance(pipeline, DauphinPipeline):
                selector = self._pipeline_run.selector
                environment_dict = self._pipeline_run.environment_dict
                mode = self._pipeline_run.mode

                pipeline_def = get_pipeline_def_from_selector(
                    graphene_info, selector)
                if is_config_valid(pipeline_def, environment_dict, mode):
                    return get_execution_plan(graphene_info, selector,
                                              environment_dict, mode)

            return None
示例#2
0
    def get_pipeline_index(self):
        if self._cached_pipeline_index is None:
            from dagster.core.snap.pipeline_snapshot import PipelineIndex, PipelineSnapshot

            self._cached_pipeline_index = PipelineIndex(PipelineSnapshot.from_pipeline_def(self))

        return self._cached_pipeline_index
 def __init__(self, repository_snapshot):
     self.repository_snapshot = check.inst_param(repository_snapshot,
                                                 'repository_snapshot',
                                                 RepositorySnapshot)
     self._pipeline_index_map = OrderedDict(
         (pipeline_snapshot.name, PipelineIndex(pipeline_snapshot))
         for pipeline_snapshot in repository_snapshot.pipeline_snapshots)
示例#4
0
def _get_dauphin_pipeline_snapshot_from_instance(instance, snapshot_id):
    from dagster_graphql.schema.errors import DauphinPipelineSnapshotNotFoundError

    if not instance.has_pipeline_snapshot(snapshot_id):
        raise UserFacingGraphQLError(DauphinPipelineSnapshotNotFoundError(snapshot_id))

    pipeline_snapshot = instance.get_pipeline_snapshot(snapshot_id)

    if not pipeline_snapshot:
        # Either a temporary error or it has been deleted in the interim
        raise UserFacingGraphQLError(DauphinPipelineSnapshotNotFoundError(snapshot_id))

    return DauphinPipelineSnapshot(PipelineIndex(pipeline_snapshot))
示例#5
0
def get_pipeline_snapshot(graphene_info, snapshot_id):
    check.str_param(snapshot_id, 'snapshot_id')
    pipeline_snapshot = graphene_info.context.instance.get_pipeline_snapshot(snapshot_id)
    return DauphinPipelineSnapshot(PipelineIndex(pipeline_snapshot))