Coverage for python/lsst/ctrl/mpexec/cli/script/run.py: 56%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

9 statements  

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 

22import logging 

23from types import SimpleNamespace 

24 

25from ... import CmdLineFwk, TaskFactory 

26 

27_log = logging.getLogger(__name__) 

28 

29 

30def run( 

31 do_raise, 

32 graph_fixup, 

33 init_only, 

34 no_versions, 

35 processes, 

36 start_method, 

37 profile, 

38 qgraphObj, 

39 register_dataset_types, 

40 skip_init_writes, 

41 timeout, 

42 butler_config, 

43 input, 

44 output, 

45 output_run, 

46 extend_run, 

47 replace_run, 

48 prune_replaced, 

49 data_query, 

50 skip_existing_in, 

51 skip_existing, 

52 debug, 

53 fail_fast, 

54 clobber_outputs, 

55 summary, 

56 mock, 

57 mock_configs, 

58 **kwargs, 

59): 

60 """Implements the command line interface `pipetask run` subcommand, should 

61 only be called by command line tools and unit test code that test this 

62 function. 

63 

64 Parameters 

65 ---------- 

66 do_raise : `bool` 

67 Raise an exception in the case of an error. 

68 graph_fixup : `str` 

69 The name of the class or factory method which makes an instance used 

70 for execution graph fixup. 

71 init_only : `bool` 

72 If true, do not actually run; just register dataset types and/or save 

73 init outputs. 

74 no_versions : `bool` 

75 If true, do not save or check package versions. 

76 processes : `int` 

77 The number of processes to use. 

78 start_method : `str` or `None` 

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

80 one for current platform. 

81 profile : `str` 

82 File name to dump cProfile information to. 

83 qgraphObj : `lsst.pipe.base.QuantumGraph` 

84 A QuantumGraph generated by a previous subcommand. 

85 register_dataset_types : `bool` 

86 If true, register DatasetTypes that do not already exist in the 

87 Registry. 

88 skip_init_writes : `bool` 

89 If true, do not write collection-wide 'init output' datasets (e.g. 

90 schemas). 

91 timeout : `int` 

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

93 butler_config : `str`, `dict`, or `lsst.daf.butler.Config` 

94 If `str`, `butler_config` is the path location of the gen3 

95 butler/registry config file. If `dict`, `butler_config` is key value 

96 pairs used to init or update the `lsst.daf.butler.Config` instance. If 

97 `Config`, it is the object used to configure a Butler. 

98 input : `list` [ `str` ] 

99 List of names of the input collection(s). 

100 output : `str` 

101 Name of the output CHAINED collection. This may either be an existing 

102 CHAINED collection to use as both input and output (if `input` is 

103 `None`), or a new CHAINED collection created to include all inputs 

104 (if `input` is not `None`). In both cases, the collection's children 

105 will start with an output RUN collection that directly holds all new 

106 datasets (see `output_run`). 

107 output_run : `str` 

108 Name of the new output RUN collection. If not provided then `output` 

109 must be provided and a new RUN collection will be created by appending 

110 a timestamp to the value passed with `output`. If this collection 

111 already exists then `extend_run` must be passed. 

112 extend_run : `bool` 

113 Instead of creating a new RUN collection, insert datasets into either 

114 the one given by `output_run` (if provided) or the first child 

115 collection of `output` (which must be of type RUN). 

116 replace_run : `bool` 

117 Before creating a new RUN collection in an existing CHAINED collection, 

118 remove the first child collection (which must be of type RUN). This can 

119 be used to repeatedly write to the same (parent) collection during 

120 development, but it does not delete the datasets associated with the 

121 replaced run unless `prune-replaced` is also True. Requires `output`, 

122 and `extend_run` must be `None`. 

123 prune_replaced : "unstore", "purge", or `None`. 

124 If not `None`, delete the datasets in the collection replaced by 

125 `replace_run`, either just from the datastore ("unstore") or by 

126 removing them and the RUN completely ("purge"). Requires `replace_run`. 

127 data_query : `str` 

128 User query selection expression. 

129 skip_existing_in : `list` [ `str` ] 

130 Accepts list of collections, if all Quantum outputs already exist in 

131 the specified list of collections then that Quantum will be excluded 

132 from the QuantumGraph. 

133 skip_existing : `bool` 

134 Appends output RUN collection to the ``skip_existing_in`` list. 

135 debug : `bool` 

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

137 debug.py). 

138 fail_fast : `bool` 

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

140 tasks as possible. 

141 clobber_outputs : `bool` 

142 Remove outputs from previous execution of the same quantum before new 

143 execution. Only applies to failed quanta if skip_existing is also 

144 given. 

145 summary : `str` 

146 File path to store job report in JSON format. 

147 mock : `bool`, optional 

148 If `True` then run mock pipeline instead of real one. 

149 mock_configs : `list` [ `PipelineAction` ] 

150 A list of config overrides for mock tasks. 

151 kwargs : `dict` [`str`, `str`] 

152 Ignored; click commands may accept options for more than one script 

153 function and pass all the option kwargs to each of the script functions 

154 which ingore these unused kwargs. 

155 """ 

156 args = SimpleNamespace( 

157 do_raise=do_raise, 

158 graph_fixup=graph_fixup, 

159 init_only=init_only, 

160 no_versions=no_versions, 

161 processes=processes, 

162 start_method=start_method, 

163 profile=profile, 

164 skip_init_writes=skip_init_writes, 

165 timeout=timeout, 

166 register_dataset_types=register_dataset_types, 

167 butler_config=butler_config, 

168 input=input, 

169 output=output, 

170 output_run=output_run, 

171 extend_run=extend_run, 

172 replace_run=replace_run, 

173 prune_replaced=prune_replaced, 

174 data_query=data_query, 

175 skip_existing_in=skip_existing_in, 

176 skip_existing=skip_existing, 

177 enableLsstDebug=debug, 

178 fail_fast=fail_fast, 

179 clobber_outputs=clobber_outputs, 

180 summary=summary, 

181 mock=mock, 

182 mock_configs=mock_configs, 

183 ) 

184 

185 f = CmdLineFwk() 

186 taskFactory = TaskFactory() 

187 f.runPipeline(qgraphObj, taskFactory, args)