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

7 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-14 09:14 +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) -> None: 

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

44 

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

46 this function. 

47 

48 Parameters 

49 ---------- 

50 butler_config : `str` 

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

52 qgraph : `str` 

53 URI location for a serialized quantum graph definition. 

54 config_search_path : `list` [`str`] 

55 Additional search paths for butler configuration. 

56 qgraph_id : `str` or `None` 

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

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

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

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

61 nodes are identified by integer IDs. 

62 processes : `int` 

63 The number of processes to use. 

64 pdb : `str` or `None` 

65 Debugger to launch for exceptions. 

66 profile : `str` 

67 File name to dump cProfile information to. 

68 debug : `bool` 

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

70 debug.py). 

71 start_method : `str` or `None` 

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

73 one for current platform. 

74 timeout : `int` 

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

76 fail_fast : `bool` 

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

78 tasks as possible. 

79 summary : `str` or `None` 

80 File path to store job report in JSON format. 

81 enable_implicit_threading : `bool` 

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

83 Implicit threading is always disabled during actual quantum execution 

84 if ``processes > 1``. 

85 """ 

86 args = SimpleNamespace( 

87 butler_config=butler_config, 

88 qgraph=qgraph, 

89 config_search_path=config_search_path, 

90 qgraph_id=qgraph_id, 

91 qgraph_node_id=qgraph_node_id, 

92 processes=processes, 

93 pdb=pdb, 

94 profile=profile, 

95 enableLsstDebug=debug, 

96 start_method=start_method, 

97 timeout=timeout, 

98 fail_fast=fail_fast, 

99 summary=summary, 

100 enable_implicit_threading=enable_implicit_threading, 

101 ) 

102 

103 f = CmdLineFwk() 

104 task_factory = TaskFactory() 

105 f.runGraphQBB(task_factory, args)