def factory(saved=False): nonlocal counter counter += 1 pipeline = Pipeline('Test Pipeline-{}'.format(counter), [], None, None) if saved: task = task_factory(True) task.add_pipeline(pipeline) return pipeline
def to_obj(self) -> Pipeline: pipeline = Pipeline(name=self.name, steps=safe_loads(self.steps, List[PipelineStep]), input_data=safe_loads(self.input_data, DatasetType), output_data=safe_loads(self.output_data, DatasetType), author=self.author, creation_date=self.creation_date, id=self.id, task_id=self.task_id) return self.attach(pipeline)
def create_pipeline(self, pipeline: Pipeline) -> Pipeline: self._validate_pipeline(pipeline) existing_task = self.get_task_by_id(pipeline.task_id) if existing_task is None: raise NonExistingTaskError(pipeline.task_id) if self.get_pipeline_by_name(pipeline.name, existing_task) is not None: raise ExistingPipelineError(pipeline) pipeline._id = self.data.get_and_increment('next_pipeline_id') self.data.add_pipeline(copy.deepcopy(pipeline)) self.save() return pipeline
def pipeline(): return Pipeline('Test Pipeline', [PipelineStep('a', 'b'), PipelineStep('c', 'd')], NumpyNdarrayDatasetType, NumpyNdarrayDatasetType)
def delete_pipeline(self, pipeline: Pipeline): if pipeline.id is None: raise NonExistingPipelineError(pipeline) self.data.remove_pipeline(pipeline.id) self.save() pipeline.unbind_meta_repo()
def pipeline(): return Pipeline('Test Pipeline', [PipelineStep('a', 'b'), PipelineStep('c', 'd')], None, None)
def pipeline2(): return Pipeline('Test Pipeline2', [PipelineStep('b', 'c')], None, None)
def delete_pipeline(self, pipeline: Pipeline): self._delete_object(self.pipelines, pipeline, NonExistingPipelineError, AssertionError) pipeline.unbind_meta_repo()