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

7 statements  

« prev     ^ index     » next       coverage.py v7.2.5, created at 2023-05-06 02:45 -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 

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 """Implements the command line interface `pipetask run-qbb` subcommand, 

44 should only be called by command line tools and unit test code that tests 

45 this function. 

46 

47 Parameters 

48 ---------- 

49 butler_config : `str` 

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

51 qgraph : `str` 

52 URI location for a serialized quantum graph definition. 

53 config_search_path : `list` [`str`] 

54 Additional search paths for butler configuration. 

55 qgraph_id : `str` or `None` 

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

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

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

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

60 nodes are identified by integer IDs. 

61 processes : `int` 

62 The number of processes to use. 

63 pdb : `str` or `None` 

64 Debugger to launch for exceptions. 

65 profile : `str` 

66 File name to dump cProfile information to. 

67 debug : `bool` 

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

69 debug.py). 

70 start_method : `str` or `None` 

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

72 one for current platform. 

73 timeout : `int` 

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

75 fail_fast : `bool` 

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

77 tasks as possible. 

78 summary : `str` or `None` 

79 File path to store job report in JSON format. 

80 enable_implicit_threading : `bool` 

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

82 Implicit threading is always disabled during actual quantum execution 

83 if ``processes > 1``. 

84 """ 

85 args = SimpleNamespace( 

86 butler_config=butler_config, 

87 qgraph=qgraph, 

88 config_search_path=config_search_path, 

89 qgraph_id=qgraph_id, 

90 qgraph_node_id=qgraph_node_id, 

91 processes=processes, 

92 pdb=pdb, 

93 profile=profile, 

94 enableLsstDebug=debug, 

95 start_method=start_method, 

96 timeout=timeout, 

97 fail_fast=fail_fast, 

98 summary=summary, 

99 enable_implicit_threading=enable_implicit_threading, 

100 ) 

101 

102 f = CmdLineFwk() 

103 task_factory = TaskFactory() 

104 f.runGraphQBB(task_factory, args)