Coverage for python/lsst/ctrl/mpexec/executionGraphFixup.py: 86%
7 statements
« prev ^ index » next coverage.py v6.5.0, created at 2022-10-14 01:55 -0700
« prev ^ index » next coverage.py v6.5.0, created at 2022-10-14 01:55 -0700
1# This file is part of ctrl_mpexec.
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__all__ = ["ExecutionGraphFixup"]
24from abc import ABC, abstractmethod
26from lsst.pipe.base import QuantumGraph
29class ExecutionGraphFixup(ABC):
30 """Interface for classes which update quantum graphs before execution.
32 Primary goal of this class is to modify quanta dependencies which may
33 not be possible to reflect in a quantum graph using standard tools.
34 One known use case for that is to guarantee particular execution order
35 of visits in CI jobs for cases when outcome depends on the processing
36 order of visits (e.g. AP association pipeline).
38 Instances of this class receive pre-ordered sequence of quanta
39 (`~lsst.pipe.base.QuantumIterData` instances) and they are allowed to
40 modify quanta data in place, for example update ``dependencies`` field to
41 add additional dependencies. Returned list of quanta will be re-ordered
42 once again by the graph executor to reflect new dependencies.
43 """
45 @abstractmethod
46 def fixupQuanta(self, graph: QuantumGraph) -> QuantumGraph:
47 """Update quanta in a graph.
49 Potentially anything in the graph could be changed if it does not
50 break executor assumptions. If modifications result in a dependency
51 cycle the executor will raise an exception.
53 Parameters
54 ----------
55 graph : QuantumGraph
56 Quantum Graph that will be executed by the executor
58 Returns
59 -------
60 graph : QuantumGraph
61 """
62 raise NotImplementedError