Coverage for python/lsst/ctrl/mpexec/executionGraphFixup.py: 86%

7 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2022-10-26 02:04 -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/>. 

21 

22__all__ = ["ExecutionGraphFixup"] 

23 

24from abc import ABC, abstractmethod 

25 

26from lsst.pipe.base import QuantumGraph 

27 

28 

29class ExecutionGraphFixup(ABC): 

30 """Interface for classes which update quantum graphs before execution. 

31 

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). 

37 

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 """ 

44 

45 @abstractmethod 

46 def fixupQuanta(self, graph: QuantumGraph) -> QuantumGraph: 

47 """Update quanta in a graph. 

48 

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. 

52 

53 Parameters 

54 ---------- 

55 graph : QuantumGraph 

56 Quantum Graph that will be executed by the executor 

57 

58 Returns 

59 ------- 

60 graph : QuantumGraph 

61 """ 

62 raise NotImplementedError