Example #1
0
    def create_run(self, pipeline_run):
        check.inst_param(pipeline_run, 'pipeline_run', PipelineRun)

        if self.has_run(pipeline_run.run_id):
            raise DagsterRunAlreadyExists(
                'Attempting to create a pipeline run for an existing run id, {run_id}'
                .format(run_id=pipeline_run.run_id))

        run = self._run_storage.add_run(pipeline_run)
        return run
Example #2
0
    def add_run(self, pipeline_run):
        check.inst_param(pipeline_run, "pipeline_run", PipelineRun)
        if self._runs.get(pipeline_run.run_id):
            raise DagsterRunAlreadyExists(
                "Can not add same run twice for run_id {run_id}".format(
                    run_id=pipeline_run.run_id), )
        if pipeline_run.pipeline_snapshot_id:
            if not self.has_pipeline_snapshot(
                    pipeline_run.pipeline_snapshot_id):
                raise DagsterSnapshotDoesNotExist(
                    "pipeline_snapshot_id {ss_id} does not exist in run storage."
                    .format(ss_id=pipeline_run.pipeline_snapshot_id))

        self._runs[pipeline_run.run_id] = pipeline_run
        if pipeline_run.tags and len(pipeline_run.tags) > 0:
            self._run_tags[pipeline_run.run_id] = frozendict(pipeline_run.tags)

        return pipeline_run