Hide keyboard shortcuts

Hot-keys 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

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__.partition(".")[2]) 

28 

29 

30def run(do_raise, 

31 graph_fixup, 

32 init_only, 

33 no_versions, 

34 processes, 

35 profile, 

36 qgraphObj, 

37 register_dataset_types, 

38 skip_init_writes, 

39 timeout, 

40 butler_config, 

41 input, 

42 output, 

43 output_run, 

44 extend_run, 

45 replace_run, 

46 prune_replaced, 

47 data_query, 

48 skip_existing, 

49 debug, 

50 fail_fast, 

51 clobber_partial_outputs, 

52 **kwargs): 

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

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

55 function. 

56 

57 Parameters 

58 ---------- 

59 do_raise : `bool` 

60 Raise an exception in the case of an error. 

61 graph_fixup : `str` 

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

63 for execution graph fixup. 

64 init_only : `bool` 

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

66 init outputs. 

67 no_versions : `bool` 

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

69 processes : `int` 

70 The number of processes to use. 

71 profile : `str` 

72 File name to dump cProfile information to. 

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

74 A QuantumGraph generated by a previous subcommand. 

75 register_dataset_types : `bool` 

76 If true, register DatasetTypes that do not already exist in the Registry. 

77 skip_init_writes : `bool` 

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

79 schemas). 

80 timeout : `int` 

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

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

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

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

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

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

87 input : `str` 

88 Comma-separated names of the input collection(s). Entries may include a 

89 colon (:), the first string is a dataset type name that restricts the 

90 search in that collection. 

91 output : `str` 

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

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

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

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

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

97 datasets (see `output_run`). 

98 output_run : `str` 

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

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

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

102 already exists then `extend_run` must be passed. 

103 extend_run : `bool` 

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

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

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

107 replace_run : `bool` 

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

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

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

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

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

113 and `extend_run` must be `None`. 

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

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

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

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

118 data_query : `str` 

119 User query selection expression. 

120 skip_existing : `bool` 

121 If all Quantum outputs already exist in the output RUN collection then 

122 that Quantum will be excluded from the QuantumGraph. Requires the 'run` 

123 command's `--extend-run` flag to be set. 

124 debug : `bool` 

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

126 debug.py). 

127 fail_fast : `bool` 

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

129 tasks as possible. 

130 clobber_partial_outputs : `bool` 

131 Remove incomplete outputs from previous execution of the same quantum 

132 before new execution. 

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

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

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

136 which ingore these unused kwargs. 

137 """ 

138 args = SimpleNamespace(do_raise=do_raise, 

139 graph_fixup=graph_fixup, 

140 init_only=init_only, 

141 no_versions=no_versions, 

142 processes=processes, 

143 profile=profile, 

144 skip_init_writes=skip_init_writes, 

145 timeout=timeout, 

146 register_dataset_types=register_dataset_types, 

147 butler_config=butler_config, 

148 input=input, 

149 output=output, 

150 output_run=output_run, 

151 extend_run=extend_run, 

152 replace_run=replace_run, 

153 prune_replaced=prune_replaced, 

154 data_query=data_query, 

155 skip_existing=skip_existing, 

156 enableLsstDebug=debug, 

157 fail_fast=fail_fast, 

158 clobber_partial_outputs=clobber_partial_outputs) 

159 

160 f = CmdLineFwk() 

161 taskFactory = TaskFactory() 

162 f.runPipeline(qgraphObj, taskFactory, args)