Coverage for python/lsst/ctrl/mpexec/cli/opt/optionGroups.py: 84%
Shortcuts on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
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.utils import OptionGroup, option_section, unwrap
38from . import options as ctrlMpExecOpts
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)
46class pipeline_build_options(OptionGroup): # noqa: N801
47 """Decorator to add options to the command function for building a
48 pipeline."""
50 def __init__(self):
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 ]
72class qgraph_options(OptionGroup): # noqa: N801
73 """Decorator to add options to a command function for creating a quantum
74 graph."""
76 def __init__(self):
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.skip_existing_in_option(),
83 ctrlMpExecOpts.skip_existing_option(),
84 ctrlMpExecOpts.clobber_outputs_option(),
85 ctrlMpExecOpts.save_qgraph_option(),
86 ctrlMpExecOpts.save_single_quanta_option(),
87 ctrlMpExecOpts.qgraph_dot_option(),
88 ctrlMpExecOpts.save_execution_butler_option(),
89 ctrlMpExecOpts.clobber_execution_butler_option(),
90 ctrlMpExecOpts.dataset_query_constraint(),
91 ctrlMpExecOpts.qgraph_header_data_option(),
92 ]
95class butler_options(OptionGroup): # noqa: N801
96 """Decorator to add options to a command function for configuring a
97 butler."""
99 def __init__(self):
100 self.decorators = [
101 option_section(sectionText="Data repository and selection options:"),
102 ctrlMpExecOpts.butler_config_option(required=True),
103 ctrlMpExecOpts.input_option(),
104 ctrlMpExecOpts.output_option(),
105 ctrlMpExecOpts.output_run_option(),
106 ctrlMpExecOpts.extend_run_option(),
107 ctrlMpExecOpts.replace_run_option(),
108 ctrlMpExecOpts.prune_replaced_option(),
109 ctrlMpExecOpts.data_query_option(),
110 ]
113class execution_options(OptionGroup): # noqa: N801
114 """Decorator to add options to a command function for executing a
115 pipeline."""
117 def __init__(self):
118 self.decorators = [
119 option_section(sectionText="Execution options:"),
120 ctrlMpExecOpts.clobber_outputs_option(),
121 ctrlMpExecOpts.pdb_option(),
122 ctrlMpExecOpts.profile_option(),
123 dafButlerOpts.processes_option(),
124 ctrlMpExecOpts.start_method_option(),
125 ctrlMpExecOpts.timeout_option(),
126 ctrlMpExecOpts.fail_fast_option(),
127 ctrlMpExecOpts.graph_fixup_option(),
128 ctrlMpExecOpts.mock_option(),
129 ctrlMpExecOpts.summary_option(),
130 ]
133class meta_info_options(OptionGroup): # noqa: N801
134 """Decorator to add options to a command function for managing pipeline
135 meta information."""
137 def __init__(self):
138 self.decorators = [
139 option_section(sectionText="Meta-information output options:"),
140 ctrlMpExecOpts.skip_init_writes_option(),
141 ctrlMpExecOpts.init_only_option(),
142 dafButlerOpts.register_dataset_types_option(),
143 ctrlMpExecOpts.no_versions_option(),
144 ]
147class run_options(OptionGroup): # noqa: N801
148 """Decorator to add the run options to the run command."""
150 def __init__(self):
151 self.decorators = [
152 click.pass_context,
153 ctrlMpExecOpts.debug_option(),
154 ctrlMpExecOpts.show_option(),
155 pipeline_build_options(),
156 qgraph_options(),
157 butler_options(),
158 execution_options(),
159 meta_info_options(),
160 option_section(sectionText=""),
161 dafButlerOpts.options_file_option(),
162 ]