Coverage for python/lsst/ctrl/mpexec/cli/opt/optionGroups.py: 76%

29 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-09 02:48 -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# (https://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 

22 

23__all__ = ( 

24 "butler_options", 

25 "coverage_options", 

26 "execution_options", 

27 "meta_info_options", 

28 "pipeline_build_options", 

29 "qgraph_options", 

30 "run_options", 

31) 

32 

33 

34import click 

35import lsst.daf.butler.cli.opt as dafButlerOpts 

36import lsst.pipe.base.cli.opt as pipeBaseOpts 

37from lsst.daf.butler.cli.opt import transfer_option 

38from lsst.daf.butler.cli.utils import OptionGroup, option_section, unwrap 

39 

40from . import options as ctrlMpExecOpts 

41 

42instrumentOptionHelp = ( 

43 "Add an instrument which will be used to load config overrides when " 

44 "defining a pipeline. This must be the fully qualified class name." 

45) 

46 

47 

48class pipeline_build_options(OptionGroup): # noqa: N801 

49 """Decorator to add options to the command function for building a 

50 pipeline.""" 

51 

52 def __init__(self) -> None: 

53 self.decorators = [ 

54 option_section(sectionText="Pipeline build options:"), 

55 ctrlMpExecOpts.pipeline_option(), 

56 ctrlMpExecOpts.task_option(), 

57 ctrlMpExecOpts.delete_option(metavar="LABEL"), 

58 dafButlerOpts.config_option(metavar="LABEL:NAME=VALUE", multiple=True), 

59 dafButlerOpts.config_file_option( 

60 help=unwrap( 

61 """Configuration override file(s), applies to a task 

62 with a given label.""" 

63 ), 

64 metavar="LABEL:FILE", 

65 multiple=True, 

66 ), 

67 ctrlMpExecOpts.order_pipeline_option(), 

68 ctrlMpExecOpts.save_pipeline_option(), 

69 ctrlMpExecOpts.pipeline_dot_option(), 

70 pipeBaseOpts.instrument_option(help=instrumentOptionHelp, metavar="instrument", multiple=True), 

71 ] 

72 

73 

74class coverage_options(OptionGroup): # noqa: N801 

75 """Decorator to add options to the command function for test coverage.""" 

76 

77 def __init__(self) -> None: 

78 self.decorators = [ 

79 option_section(sectionText="Coverage options:"), 

80 ctrlMpExecOpts.coverage_option(), 

81 ctrlMpExecOpts.coverage_report_option(), 

82 ctrlMpExecOpts.coverage_packages_option(), 

83 ] 

84 

85 

86class qgraph_options(OptionGroup): # noqa: N801 

87 """Decorator to add options to a command function for creating a quantum 

88 graph.""" 

89 

90 def __init__(self) -> None: 

91 self.decorators = [ 

92 option_section(sectionText="Quantum graph building options:"), 

93 ctrlMpExecOpts.qgraph_option(), 

94 ctrlMpExecOpts.qgraph_id_option(), 

95 ctrlMpExecOpts.qgraph_node_id_option(), 

96 ctrlMpExecOpts.qgraph_datastore_records_option(), 

97 ctrlMpExecOpts.skip_existing_in_option(), 

98 ctrlMpExecOpts.skip_existing_option(), 

99 ctrlMpExecOpts.clobber_outputs_option(), 

100 ctrlMpExecOpts.save_qgraph_option(), 

101 ctrlMpExecOpts.save_single_quanta_option(), 

102 ctrlMpExecOpts.qgraph_dot_option(), 

103 ctrlMpExecOpts.save_execution_butler_option(), 

104 ctrlMpExecOpts.clobber_execution_butler_option(), 

105 ctrlMpExecOpts.target_datastore_root_option(), 

106 transfer_option( 

107 help=unwrap( 

108 """Data transfer mode for the execution butler datastore. 

109 Defaults to "copy" if --target-datastore-root is provided. 

110 """ 

111 ), 

112 ), 

113 ctrlMpExecOpts.dataset_query_constraint(), 

114 ctrlMpExecOpts.qgraph_header_data_option(), 

115 ctrlMpExecOpts.mock_option(), 

116 coverage_options(), 

117 ctrlMpExecOpts.unmocked_dataset_types_option(), 

118 ] 

119 

120 

121class butler_options(OptionGroup): # noqa: N801 

122 """Decorator to add options to a command function for configuring a 

123 butler.""" 

124 

125 def __init__(self) -> None: 

126 self.decorators = [ 

127 option_section(sectionText="Data repository and selection options:"), 

128 ctrlMpExecOpts.butler_config_option(required=True), 

129 ctrlMpExecOpts.input_option(), 

130 ctrlMpExecOpts.output_option(), 

131 ctrlMpExecOpts.output_run_option(), 

132 ctrlMpExecOpts.extend_run_option(), 

133 ctrlMpExecOpts.replace_run_option(), 

134 ctrlMpExecOpts.prune_replaced_option(), 

135 ctrlMpExecOpts.data_query_option(), 

136 ] 

137 

138 

139class execution_options(OptionGroup): # noqa: N801 

140 """Decorator to add options to a command function for executing a 

141 pipeline.""" 

142 

143 def __init__(self) -> None: 

144 self.decorators = [ 

145 option_section(sectionText="Execution options:"), 

146 ctrlMpExecOpts.clobber_outputs_option(), 

147 ctrlMpExecOpts.pdb_option(), 

148 ctrlMpExecOpts.profile_option(), 

149 dafButlerOpts.processes_option(), 

150 ctrlMpExecOpts.start_method_option(), 

151 ctrlMpExecOpts.timeout_option(), 

152 ctrlMpExecOpts.fail_fast_option(), 

153 ctrlMpExecOpts.graph_fixup_option(), 

154 ctrlMpExecOpts.summary_option(), 

155 ctrlMpExecOpts.enable_implicit_threading_option(), 

156 ] 

157 

158 

159class meta_info_options(OptionGroup): # noqa: N801 

160 """Decorator to add options to a command function for managing pipeline 

161 meta information.""" 

162 

163 def __init__(self) -> None: 

164 self.decorators = [ 

165 option_section(sectionText="Meta-information output options:"), 

166 ctrlMpExecOpts.skip_init_writes_option(), 

167 ctrlMpExecOpts.init_only_option(), 

168 dafButlerOpts.register_dataset_types_option(), 

169 ctrlMpExecOpts.no_versions_option(), 

170 ] 

171 

172 

173class run_options(OptionGroup): # noqa: N801 

174 """Decorator to add the run options to the run command.""" 

175 

176 def __init__(self) -> None: 

177 self.decorators = [ 

178 click.pass_context, 

179 ctrlMpExecOpts.debug_option(), 

180 ctrlMpExecOpts.show_option(), 

181 pipeline_build_options(), 

182 qgraph_options(), 

183 butler_options(), 

184 execution_options(), 

185 meta_info_options(), 

186 coverage_options(), 

187 option_section(sectionText=""), 

188 dafButlerOpts.options_file_option(), 

189 ]