Coverage for python/lsst/pipe/base/taskFactory.py: 69%
14 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-03-11 10:14 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2023-03-11 10:14 +0000
1# This file is part of pipe_base.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
22"""Module defining TaskFactory interface.
23"""
25from __future__ import annotations
27__all__ = ["TaskFactory"]
29from abc import ABCMeta, abstractmethod
30from collections.abc import Iterable
31from typing import TYPE_CHECKING
33if TYPE_CHECKING: 33 ↛ 34line 33 didn't jump to line 34, because the condition on line 33 was never true
34 from lsst.daf.butler import DatasetRef, LimitedButler
36 from .pipeline import TaskDef
37 from .pipelineTask import PipelineTask
40class TaskFactory(metaclass=ABCMeta):
41 """Abstract base class for task factory.
43 Task factory is responsible for creating instances of PipelineTask
44 subclasses.
45 """
47 @abstractmethod
48 def makeTask(
49 self, taskDef: TaskDef, butler: LimitedButler, initInputRefs: Iterable[DatasetRef] | None
50 ) -> PipelineTask:
51 """Create new PipelineTask instance from its `~lsst.pipe.base.TaskDef`.
53 Parameters
54 ----------
55 taskDef : `~lsst.pipe.base.TaskDef`
56 Task definition structure.
57 butler : `lsst.daf.butler.LimitedButler`
58 Butler instance used to obtain initialization inputs for task.
59 initInputRefs : `Iterable` of `~lsst.daf.butler.DatasetRef` or `None`
60 List of resolved dataset references for init inputs for this task.
62 Returns
63 -------
64 task : `PipelineTask`
65 Instance of a PipelineTask class.
67 Raises
68 ------
69 Any exceptions that are raised by PipelineTask constructor or its
70 configuration class are propagated back to caller.
71 """
72 raise NotImplementedError()