Coverage for python/lsst/ctrl/mpexec/cli/opt/optionGroups.py: 77%
26 statements
« prev ^ index » next coverage.py v6.5.0, created at 2022-12-06 02:03 -0800
« prev ^ index » next coverage.py v6.5.0, created at 2022-12-06 02:03 -0800
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 "execution_options",
26 "meta_info_options",
27 "pipeline_build_options",
28 "qgraph_options",
29 "run_options",
30)
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
39from . import options as ctrlMpExecOpts
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)
47class pipeline_build_options(OptionGroup): # noqa: N801
48 """Decorator to add options to the command function for building a
49 pipeline."""
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 ]
73class qgraph_options(OptionGroup): # noqa: N801
74 """Decorator to add options to a command function for creating a quantum
75 graph."""
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 ]
105class butler_options(OptionGroup): # noqa: N801
106 """Decorator to add options to a command function for configuring a
107 butler."""
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 ]
123class execution_options(OptionGroup): # noqa: N801
124 """Decorator to add options to a command function for executing a
125 pipeline."""
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 ctrlMpExecOpts.enable_implicit_threading_option(),
141 ]
144class meta_info_options(OptionGroup): # noqa: N801
145 """Decorator to add options to a command function for managing pipeline
146 meta information."""
148 def __init__(self) -> None:
149 self.decorators = [
150 option_section(sectionText="Meta-information output options:"),
151 ctrlMpExecOpts.skip_init_writes_option(),
152 ctrlMpExecOpts.init_only_option(),
153 dafButlerOpts.register_dataset_types_option(),
154 ctrlMpExecOpts.no_versions_option(),
155 ]
158class run_options(OptionGroup): # noqa: N801
159 """Decorator to add the run options to the run command."""
161 def __init__(self) -> None:
162 self.decorators = [
163 click.pass_context,
164 ctrlMpExecOpts.debug_option(),
165 ctrlMpExecOpts.show_option(),
166 pipeline_build_options(),
167 qgraph_options(),
168 butler_options(),
169 execution_options(),
170 meta_info_options(),
171 option_section(sectionText=""),
172 dafButlerOpts.options_file_option(),
173 ]