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

26 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2022-10-22 01:58 -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 "execution_options", 

26 "meta_info_options", 

27 "pipeline_build_options", 

28 "qgraph_options", 

29 "run_options", 

30) 

31 

32 

33import click 

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

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

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

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

38 

39from . import options as ctrlMpExecOpts 

40 

41instrumentOptionHelp = ( 

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

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

44) 

45 

46 

47class pipeline_build_options(OptionGroup): # noqa: N801 

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

49 pipeline.""" 

50 

51 def __init__(self) -> None: 

52 self.decorators = [ 

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

54 ctrlMpExecOpts.pipeline_option(), 

55 ctrlMpExecOpts.task_option(), 

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

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

58 dafButlerOpts.config_file_option( 

59 help=unwrap( 

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

61 with a given label.""" 

62 ), 

63 metavar="LABEL:FILE", 

64 multiple=True, 

65 ), 

66 ctrlMpExecOpts.order_pipeline_option(), 

67 ctrlMpExecOpts.save_pipeline_option(), 

68 ctrlMpExecOpts.pipeline_dot_option(), 

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

70 ] 

71 

72 

73class qgraph_options(OptionGroup): # noqa: N801 

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

75 graph.""" 

76 

77 def __init__(self) -> None: 

78 self.decorators = [ 

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

80 ctrlMpExecOpts.qgraph_option(), 

81 ctrlMpExecOpts.qgraph_id_option(), 

82 ctrlMpExecOpts.qgraph_node_id_option(), 

83 ctrlMpExecOpts.qgraph_datastore_records_option(), 

84 ctrlMpExecOpts.skip_existing_in_option(), 

85 ctrlMpExecOpts.skip_existing_option(), 

86 ctrlMpExecOpts.clobber_outputs_option(), 

87 ctrlMpExecOpts.save_qgraph_option(), 

88 ctrlMpExecOpts.save_single_quanta_option(), 

89 ctrlMpExecOpts.qgraph_dot_option(), 

90 ctrlMpExecOpts.save_execution_butler_option(), 

91 ctrlMpExecOpts.clobber_execution_butler_option(), 

92 ctrlMpExecOpts.target_datastore_root_option(), 

93 transfer_option( 

94 help=unwrap( 

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

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

97 """ 

98 ), 

99 ), 

100 ctrlMpExecOpts.dataset_query_constraint(), 

101 ctrlMpExecOpts.qgraph_header_data_option(), 

102 ] 

103 

104 

105class butler_options(OptionGroup): # noqa: N801 

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

107 butler.""" 

108 

109 def __init__(self) -> None: 

110 self.decorators = [ 

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

112 ctrlMpExecOpts.butler_config_option(required=True), 

113 ctrlMpExecOpts.input_option(), 

114 ctrlMpExecOpts.output_option(), 

115 ctrlMpExecOpts.output_run_option(), 

116 ctrlMpExecOpts.extend_run_option(), 

117 ctrlMpExecOpts.replace_run_option(), 

118 ctrlMpExecOpts.prune_replaced_option(), 

119 ctrlMpExecOpts.data_query_option(), 

120 ] 

121 

122 

123class execution_options(OptionGroup): # noqa: N801 

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

125 pipeline.""" 

126 

127 def __init__(self) -> None: 

128 self.decorators = [ 

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

130 ctrlMpExecOpts.clobber_outputs_option(), 

131 ctrlMpExecOpts.pdb_option(), 

132 ctrlMpExecOpts.profile_option(), 

133 dafButlerOpts.processes_option(), 

134 ctrlMpExecOpts.start_method_option(), 

135 ctrlMpExecOpts.timeout_option(), 

136 ctrlMpExecOpts.fail_fast_option(), 

137 ctrlMpExecOpts.graph_fixup_option(), 

138 ctrlMpExecOpts.mock_option(), 

139 ctrlMpExecOpts.summary_option(), 

140 ] 

141 

142 

143class meta_info_options(OptionGroup): # noqa: N801 

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

145 meta information.""" 

146 

147 def __init__(self) -> None: 

148 self.decorators = [ 

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

150 ctrlMpExecOpts.skip_init_writes_option(), 

151 ctrlMpExecOpts.init_only_option(), 

152 dafButlerOpts.register_dataset_types_option(), 

153 ctrlMpExecOpts.no_versions_option(), 

154 ] 

155 

156 

157class run_options(OptionGroup): # noqa: N801 

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

159 

160 def __init__(self) -> None: 

161 self.decorators = [ 

162 click.pass_context, 

163 ctrlMpExecOpts.debug_option(), 

164 ctrlMpExecOpts.show_option(), 

165 pipeline_build_options(), 

166 qgraph_options(), 

167 butler_options(), 

168 execution_options(), 

169 meta_info_options(), 

170 option_section(sectionText=""), 

171 dafButlerOpts.options_file_option(), 

172 ]