def _makePipeline(tasks): """Generate Pipeline instance. Parameters ---------- tasks : list of tuples Each tuple in the list has 3 or 4 items: - input DatasetType name(s), string or tuple of strings - output DatasetType name(s), string or tuple of strings - task label, string - optional task class object, can be None Returns ------- Pipeline instance """ pipe = Pipeline() for task in tasks: inputs = task[0] outputs = task[1] label = task[2] klass = task[3] if len(task) > 3 else ExamplePipelineTask config = _makeConfig(inputs, outputs) pipe.append(TaskDef("ExamplePipelineTask", config, klass, label)) return pipe
def testAppend(self): """Testing append() method """ pipeline = Pipeline() self.assertEqual(len(pipeline), 0) pipeline.append(TaskDef("lsst.pipe.base.tests.Add", AddConfig())) pipeline.append(TaskDef("lsst.pipe.base.tests.Mult", MultConfig())) self.assertEqual(len(pipeline), 2) self.assertEqual(pipeline[0].taskName, "lsst.pipe.base.tests.Add") self.assertEqual(pipeline[1].taskName, "lsst.pipe.base.tests.Mult")