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-28 10:40 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-28 10:40 +0000
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/>.
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)
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
40from . import options as ctrlMpExecOpts
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)
48class pipeline_build_options(OptionGroup): # noqa: N801
49 """Decorator to add options to the command function for building a
50 pipeline.
51 """
53 def __init__(self) -> None:
54 self.decorators = [
55 option_section(sectionText="Pipeline build options:"),
56 ctrlMpExecOpts.pipeline_option(),
57 ctrlMpExecOpts.task_option(),
58 ctrlMpExecOpts.delete_option(metavar="LABEL"),
59 dafButlerOpts.config_option(metavar="LABEL:NAME=VALUE", multiple=True),
60 dafButlerOpts.config_file_option(
61 help=unwrap(
62 """Configuration override file(s), applies to a task
63 with a given label."""
64 ),
65 metavar="LABEL:FILE",
66 multiple=True,
67 ),
68 ctrlMpExecOpts.order_pipeline_option(),
69 ctrlMpExecOpts.save_pipeline_option(),
70 ctrlMpExecOpts.pipeline_dot_option(),
71 pipeBaseOpts.instrument_option(help=instrumentOptionHelp, metavar="instrument", multiple=True),
72 ]
75class coverage_options(OptionGroup): # noqa: N801
76 """Decorator to add options to the command function for test coverage."""
78 def __init__(self) -> None:
79 self.decorators = [
80 option_section(sectionText="Coverage options:"),
81 ctrlMpExecOpts.coverage_option(),
82 ctrlMpExecOpts.coverage_report_option(),
83 ctrlMpExecOpts.coverage_packages_option(),
84 ]
87class qgraph_options(OptionGroup): # noqa: N801
88 """Decorator to add options to a command function for creating a quantum
89 graph.
90 """
92 def __init__(self) -> None:
93 self.decorators = [
94 option_section(sectionText="Quantum graph building options:"),
95 ctrlMpExecOpts.qgraph_option(),
96 ctrlMpExecOpts.qgraph_id_option(),
97 ctrlMpExecOpts.qgraph_node_id_option(),
98 ctrlMpExecOpts.qgraph_datastore_records_option(),
99 ctrlMpExecOpts.skip_existing_in_option(),
100 ctrlMpExecOpts.skip_existing_option(),
101 ctrlMpExecOpts.clobber_outputs_option(),
102 ctrlMpExecOpts.save_qgraph_option(),
103 ctrlMpExecOpts.save_single_quanta_option(),
104 ctrlMpExecOpts.qgraph_dot_option(),
105 ctrlMpExecOpts.save_execution_butler_option(),
106 ctrlMpExecOpts.clobber_execution_butler_option(),
107 ctrlMpExecOpts.target_datastore_root_option(),
108 transfer_option(
109 help=unwrap(
110 """Data transfer mode for the execution butler datastore.
111 Defaults to "copy" if --target-datastore-root is provided.
112 """
113 ),
114 ),
115 ctrlMpExecOpts.dataset_query_constraint(),
116 ctrlMpExecOpts.qgraph_header_data_option(),
117 ctrlMpExecOpts.mock_option(),
118 ctrlMpExecOpts.mock_failure_option(),
119 ctrlMpExecOpts.unmocked_dataset_types_option(),
120 coverage_options(),
121 ]
124class butler_options(OptionGroup): # noqa: N801
125 """Decorator to add options to a command function for configuring a
126 butler.
127 """
129 def __init__(self) -> None:
130 self.decorators = [
131 option_section(sectionText="Data repository and selection options:"),
132 ctrlMpExecOpts.butler_config_option(required=True),
133 ctrlMpExecOpts.input_option(),
134 ctrlMpExecOpts.output_option(),
135 ctrlMpExecOpts.output_run_option(),
136 ctrlMpExecOpts.extend_run_option(),
137 ctrlMpExecOpts.replace_run_option(),
138 ctrlMpExecOpts.prune_replaced_option(),
139 ctrlMpExecOpts.data_query_option(),
140 ]
143class execution_options(OptionGroup): # noqa: N801
144 """Decorator to add options to a command function for executing a
145 pipeline.
146 """
148 def __init__(self) -> None:
149 self.decorators = [
150 option_section(sectionText="Execution options:"),
151 ctrlMpExecOpts.clobber_outputs_option(),
152 ctrlMpExecOpts.pdb_option(),
153 ctrlMpExecOpts.profile_option(),
154 dafButlerOpts.processes_option(),
155 ctrlMpExecOpts.start_method_option(),
156 ctrlMpExecOpts.timeout_option(),
157 ctrlMpExecOpts.fail_fast_option(),
158 ctrlMpExecOpts.graph_fixup_option(),
159 ctrlMpExecOpts.summary_option(),
160 ctrlMpExecOpts.enable_implicit_threading_option(),
161 ctrlMpExecOpts.cores_per_quantum_option(),
162 ctrlMpExecOpts.memory_per_quantum_option(),
163 ]
166class meta_info_options(OptionGroup): # noqa: N801
167 """Decorator to add options to a command function for managing pipeline
168 meta information.
169 """
171 def __init__(self) -> None:
172 self.decorators = [
173 option_section(sectionText="Meta-information output options:"),
174 ctrlMpExecOpts.skip_init_writes_option(),
175 ctrlMpExecOpts.init_only_option(),
176 dafButlerOpts.register_dataset_types_option(),
177 ctrlMpExecOpts.no_versions_option(),
178 ]
181class run_options(OptionGroup): # noqa: N801
182 """Decorator to add the run options to the run command."""
184 def __init__(self) -> None:
185 self.decorators = [
186 click.pass_context,
187 ctrlMpExecOpts.debug_option(),
188 ctrlMpExecOpts.show_option(),
189 pipeline_build_options(),
190 qgraph_options(),
191 butler_options(),
192 execution_options(),
193 meta_info_options(),
194 coverage_options(),
195 option_section(sectionText=""),
196 dafButlerOpts.options_file_option(),
197 ]