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

6 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-01 12:48 +0000

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 software is dual licensed under the GNU General Public License and also 

10# under a 3-clause BSD license. Recipients may choose which of these licenses 

11# to use; please see the files gpl-3.0.txt and/or bsd_license.txt, 

12# respectively. If you choose the GPL option then the following text applies 

13# (but note that there is still no warranty even if you opt for BSD instead): 

14# 

15# This program is free software: you can redistribute it and/or modify 

16# it under the terms of the GNU General Public License as published by 

17# the Free Software Foundation, either version 3 of the License, or 

18# (at your option) any later version. 

19# 

20# This program is distributed in the hope that it will be useful, 

21# but WITHOUT ANY WARRANTY; without even the implied warranty of 

22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

23# GNU General Public License for more details. 

24# 

25# You should have received a copy of the GNU General Public License 

26# along with this program. If not, see <http://www.gnu.org/licenses/>. 

27 

28__all__ = ["ExecutionGraphFixup"] 

29 

30from abc import ABC, abstractmethod 

31 

32from lsst.pipe.base import QuantumGraph 

33 

34 

35class ExecutionGraphFixup(ABC): 

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

37 

38 Primary goal of this class is to modify quanta dependencies which may 

39 not be possible to reflect in a quantum graph using standard tools. 

40 One known use case for that is to guarantee particular execution order 

41 of visits in CI jobs for cases when outcome depends on the processing 

42 order of visits (e.g. AP association pipeline). 

43 

44 Instances of this class receive pre-ordered sequence of quanta 

45 (`~lsst.pipe.base.QuantumGraph` instances) and they are allowed to 

46 modify quanta data in place, for example update ``dependencies`` field to 

47 add additional dependencies. Returned list of quanta will be re-ordered 

48 once again by the graph executor to reflect new dependencies. 

49 """ 

50 

51 @abstractmethod 

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

53 """Update quanta in a graph. 

54 

55 Potentially anything in the graph could be changed if it does not 

56 break executor assumptions. If modifications result in a dependency 

57 cycle the executor will raise an exception. 

58 

59 Parameters 

60 ---------- 

61 graph : QuantumGraph 

62 Quantum Graph that will be executed by the executor. 

63 

64 Returns 

65 ------- 

66 graph : QuantumGraph 

67 Modified graph. 

68 """ 

69 raise NotImplementedError