Coverage for python/lsst/ctrl/mpexec/cli/script/run_qbb.py: 43%

7 statements  

« prev     ^ index     » next       coverage.py v7.3.0, created at 2023-09-01 09:30 +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 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 

22from types import SimpleNamespace 

23 

24from ... import CmdLineFwk, TaskFactory 

25 

26 

27def run_qbb( 

28 butler_config: str, 

29 qgraph: str, 

30 config_search_path: list[str] | None, 

31 qgraph_id: str | None, 

32 qgraph_node_id: list[int] | None, 

33 processes: int, 

34 pdb: str | None, 

35 profile: str | None, 

36 debug: bool, 

37 start_method: str | None, 

38 timeout: int | None, 

39 fail_fast: bool, 

40 summary: str | None, 

41 enable_implicit_threading: bool, 

42 cores_per_quantum: int, 

43 memory_per_quantum: str, 

44) -> None: 

45 """Implement the command line interface ``pipetask run-qbb`` subcommand. 

46 

47 Should only be called by command line tools and unit test code that tests 

48 this function. 

49 

50 Parameters 

51 ---------- 

52 butler_config : `str` 

53 The path location of the gen3 butler/registry config file. 

54 qgraph : `str` 

55 URI location for a serialized quantum graph definition. 

56 config_search_path : `list` [`str`] 

57 Additional search paths for butler configuration. 

58 qgraph_id : `str` or `None` 

59 Quantum graph identifier, if specified must match the identifier of the 

60 graph loaded from a file. Ignored if graph is not loaded from a file. 

61 qgraph_node_id : `iterable` of `int`, or `None` 

62 Only load a specified set of nodes if graph is loaded from a file, 

63 nodes are identified by integer IDs. 

64 processes : `int` 

65 The number of processes to use. 

66 pdb : `str` or `None` 

67 Debugger to launch for exceptions. 

68 profile : `str` 

69 File name to dump cProfile information to. 

70 debug : `bool` 

71 If true, enable debugging output using lsstDebug facility (imports 

72 debug.py). 

73 start_method : `str` or `None` 

74 Start method from `multiprocessing` module, `None` selects the best 

75 one for current platform. 

76 timeout : `int` 

77 Timeout for multiprocessing; maximum wall time (sec). 

78 fail_fast : `bool` 

79 If true then stop processing at first error, otherwise process as many 

80 tasks as possible. 

81 summary : `str` or `None` 

82 File path to store job report in JSON format. 

83 enable_implicit_threading : `bool` 

84 If `True`, do not disable implicit threading by third-party libraries. 

85 Implicit threading is always disabled during actual quantum execution 

86 if ``processes > 1``. 

87 cores_per_quantum : `int` 

88 Number of cores that can be used by each quantum. 

89 memory_per_quantum : `str` 

90 Amount of memory that each quantum can be allowed to use. Empty string 

91 implies no limit. The string can be either a single integer (implying 

92 units of MB) or a combination of number and unit. 

93 """ 

94 args = SimpleNamespace( 

95 butler_config=butler_config, 

96 qgraph=qgraph, 

97 config_search_path=config_search_path, 

98 qgraph_id=qgraph_id, 

99 qgraph_node_id=qgraph_node_id, 

100 processes=processes, 

101 pdb=pdb, 

102 profile=profile, 

103 enableLsstDebug=debug, 

104 start_method=start_method, 

105 timeout=timeout, 

106 fail_fast=fail_fast, 

107 summary=summary, 

108 enable_implicit_threading=enable_implicit_threading, 

109 cores_per_quantum=cores_per_quantum, 

110 memory_per_quantum=memory_per_quantum, 

111 ) 

112 

113 f = CmdLineFwk() 

114 task_factory = TaskFactory() 

115 f.runGraphQBB(task_factory, args)