Coverage for python/lsst/ctrl/bps/cli/cmd/commands.py: 86%
57 statements
« prev ^ index » next coverage.py v6.4.1, created at 2022-06-15 02:15 -0700
« prev ^ index » next coverage.py v6.4.1, created at 2022-06-15 02:15 -0700
1# This file is part of ctrl_bps.
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 <https://www.gnu.org/licenses/>.
21"""Subcommand definitions.
22"""
23import click
24from lsst.daf.butler.cli.utils import MWCommand
26from ...drivers import (
27 acquire_qgraph_driver,
28 cancel_driver,
29 cluster_qgraph_driver,
30 prepare_driver,
31 report_driver,
32 restart_driver,
33 submit_driver,
34 transform_driver,
35)
36from .. import opt
39class BpsCommand(MWCommand):
40 """Command subclass with bps-command specific overrides."""
42 extra_epilog = "See 'bps --help' for more options."
45@click.command(cls=BpsCommand)
46@opt.config_file_argument(required=True)
47@opt.submission_options()
48def acquire(*args, **kwargs):
49 """Create a new quantum graph or read existing one from a file."""
50 acquire_qgraph_driver(*args, **kwargs)
53@click.command(cls=BpsCommand)
54@opt.config_file_argument(required=True)
55@opt.submission_options()
56def cluster(*args, **kwargs):
57 """Create a clustered quantum graph."""
58 cluster_qgraph_driver(*args, **kwargs)
61@click.command(cls=BpsCommand)
62@opt.config_file_argument(required=True)
63@opt.submission_options()
64def transform(*args, **kwargs):
65 """Transform a quantum graph to a generic workflow."""
66 transform_driver(*args, **kwargs)
69@click.command(cls=BpsCommand)
70@opt.config_file_argument(required=True)
71@opt.wms_service_option()
72@opt.submission_options()
73def prepare(*args, **kwargs):
74 """Prepare a workflow for submission."""
75 prepare_driver(*args, **kwargs)
78@click.command(cls=BpsCommand)
79@opt.config_file_argument(required=True)
80@opt.wms_service_option()
81@opt.submission_options()
82def submit(*args, **kwargs):
83 """Submit a workflow for execution."""
84 submit_driver(*args, **kwargs)
87@click.command(cls=BpsCommand)
88@opt.wms_service_option()
89@click.option("--id", "run_id", help="Run id of workflow to restart.")
90def restart(*args, **kwargs):
91 """Restart a failed workflow."""
92 restart_driver(*args, **kwargs)
95@click.command(cls=BpsCommand)
96@opt.wms_service_option()
97@click.option("--id", "run_id", help="Restrict report to specific WMS run id.")
98@click.option("--user", help="Restrict report to specific user.")
99@click.option("--hist", "hist_days", default=0.0, help="Search WMS history X days for completed info.")
100@click.option("--pass-thru", help="Pass the given string to the WMS service class.")
101@click.option(
102 "--global/--no-global",
103 "is_global",
104 default=False,
105 help="Query all available job queues for job information.",
106)
107def report(*args, **kwargs):
108 """Display execution status for submitted workflows."""
109 report_driver(*args, **kwargs)
112@click.command(cls=BpsCommand)
113@opt.wms_service_option()
114@click.option("--id", "run_id", help="Run id of workflow to cancel.")
115@click.option("--user", help="User for which to cancel all submitted workflows.")
116@click.option(
117 "--require-bps/--skip-require-bps",
118 "require_bps",
119 default=True,
120 show_default=True,
121 help="Only cancel jobs submitted via bps.",
122)
123@click.option("--pass-thru", "pass_thru", default=str(), help="Pass the given string to the WMS service.")
124@click.option(
125 "--global/--no-global",
126 "is_global",
127 default=False,
128 help="Cancel jobs matching the search criteria from all job queues.",
129)
130def cancel(*args, **kwargs):
131 """Cancel submitted workflow(s)."""
132 cancel_driver(*args, **kwargs)