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

25 statements  

« prev     ^ index     » next       coverage.py v6.4.1, created at 2022-07-03 01:28 -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.utils import OptionGroup, option_section, unwrap 

37 

38from . import options as ctrlMpExecOpts 

39 

40instrumentOptionHelp = ( 

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

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

43) 

44 

45 

46class pipeline_build_options(OptionGroup): # noqa: N801 

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

48 pipeline.""" 

49 

50 def __init__(self) -> None: 

51 self.decorators = [ 

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

53 ctrlMpExecOpts.pipeline_option(), 

54 ctrlMpExecOpts.task_option(), 

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

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

57 dafButlerOpts.config_file_option( 

58 help=unwrap( 

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

60 with a given label.""" 

61 ), 

62 metavar="LABEL:FILE", 

63 multiple=True, 

64 ), 

65 ctrlMpExecOpts.order_pipeline_option(), 

66 ctrlMpExecOpts.save_pipeline_option(), 

67 ctrlMpExecOpts.pipeline_dot_option(), 

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

69 ] 

70 

71 

72class qgraph_options(OptionGroup): # noqa: N801 

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

74 graph.""" 

75 

76 def __init__(self) -> None: 

77 self.decorators = [ 

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

79 ctrlMpExecOpts.qgraph_option(), 

80 ctrlMpExecOpts.qgraph_id_option(), 

81 ctrlMpExecOpts.qgraph_node_id_option(), 

82 ctrlMpExecOpts.qgraph_datastore_records_option(), 

83 ctrlMpExecOpts.skip_existing_in_option(), 

84 ctrlMpExecOpts.skip_existing_option(), 

85 ctrlMpExecOpts.clobber_outputs_option(), 

86 ctrlMpExecOpts.save_qgraph_option(), 

87 ctrlMpExecOpts.save_single_quanta_option(), 

88 ctrlMpExecOpts.qgraph_dot_option(), 

89 ctrlMpExecOpts.save_execution_butler_option(), 

90 ctrlMpExecOpts.clobber_execution_butler_option(), 

91 ctrlMpExecOpts.dataset_query_constraint(), 

92 ctrlMpExecOpts.qgraph_header_data_option(), 

93 ] 

94 

95 

96class butler_options(OptionGroup): # noqa: N801 

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

98 butler.""" 

99 

100 def __init__(self) -> None: 

101 self.decorators = [ 

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

103 ctrlMpExecOpts.butler_config_option(required=True), 

104 ctrlMpExecOpts.input_option(), 

105 ctrlMpExecOpts.output_option(), 

106 ctrlMpExecOpts.output_run_option(), 

107 ctrlMpExecOpts.extend_run_option(), 

108 ctrlMpExecOpts.replace_run_option(), 

109 ctrlMpExecOpts.prune_replaced_option(), 

110 ctrlMpExecOpts.data_query_option(), 

111 ] 

112 

113 

114class execution_options(OptionGroup): # noqa: N801 

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

116 pipeline.""" 

117 

118 def __init__(self) -> None: 

119 self.decorators = [ 

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

121 ctrlMpExecOpts.clobber_outputs_option(), 

122 ctrlMpExecOpts.pdb_option(), 

123 ctrlMpExecOpts.profile_option(), 

124 dafButlerOpts.processes_option(), 

125 ctrlMpExecOpts.start_method_option(), 

126 ctrlMpExecOpts.timeout_option(), 

127 ctrlMpExecOpts.fail_fast_option(), 

128 ctrlMpExecOpts.graph_fixup_option(), 

129 ctrlMpExecOpts.mock_option(), 

130 ctrlMpExecOpts.summary_option(), 

131 ] 

132 

133 

134class meta_info_options(OptionGroup): # noqa: N801 

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

136 meta information.""" 

137 

138 def __init__(self) -> None: 

139 self.decorators = [ 

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

141 ctrlMpExecOpts.skip_init_writes_option(), 

142 ctrlMpExecOpts.init_only_option(), 

143 dafButlerOpts.register_dataset_types_option(), 

144 ctrlMpExecOpts.no_versions_option(), 

145 ] 

146 

147 

148class run_options(OptionGroup): # noqa: N801 

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

150 

151 def __init__(self) -> None: 

152 self.decorators = [ 

153 click.pass_context, 

154 ctrlMpExecOpts.debug_option(), 

155 ctrlMpExecOpts.show_option(), 

156 pipeline_build_options(), 

157 qgraph_options(), 

158 butler_options(), 

159 execution_options(), 

160 meta_info_options(), 

161 option_section(sectionText=""), 

162 dafButlerOpts.options_file_option(), 

163 ]