Skip to content

Commit

Permalink
Merge branch 'tickets/DM-27648' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mxk62 committed Nov 19, 2020
2 parents fc5c4ad + e6f776c commit d34a055
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 38 deletions.
21 changes: 11 additions & 10 deletions python/lsst/ctrl/bps/cli/cmd/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,35 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import click
from lsst.daf.butler.cli.opt import log_level_option
from lsst.daf.butler.cli.utils import cli_handle_exception
from lsst.daf.butler.cli.utils import MWCommand, cli_handle_exception
from .. import opt
from .. import script


@click.command()
class BpsCommand(MWCommand):
"""Command subclass with bps-command specific overrides."""

extra_epilog = "See 'bps --help' for more options."


@click.command(cls=BpsCommand)
@opt.config_file_argument(required=True)
@log_level_option()
def transform(*args, **kwargs):
"""Transform a quantum graph to a workflow graph.
"""
raise NotImplementedError


@click.command()
@click.command(cls=BpsCommand)
@opt.config_file_argument(required=True)
@log_level_option()
def prepare(*args, **kwargs):
"""Prepare a workflow for submission.
"""
cli_handle_exception(script.prepare, *args, **kwargs)


@click.command()
@click.command(cls=BpsCommand)
@opt.config_file_argument(required=True)
@log_level_option()
def submit(*args, **kwargs):
"""Submit a workflow for execution.
"""
Expand All @@ -54,8 +56,7 @@ def submit(*args, **kwargs):
**kwargs)


@click.command()
@log_level_option()
@click.command(cls=BpsCommand)
@click.option("--wms", "wms_service",
default="lsst.ctrl.bps.wms.htcondor.htcondor_service.HTCondorService",
help="Workload Management System service class")
Expand Down
10 changes: 1 addition & 9 deletions python/lsst/ctrl/bps/cli/script/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,17 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from lsst.daf.butler.cli.cliLog import CliLog
from ...bps_config import BpsConfig
from ...submit import BPS_SEARCH_ORDER, create_submission


def _prepare(config_file, log_level, **kwargs):
def _prepare(config_file, **kwargs):
"""Create a workflow for a specific workflow management system.
Parameters
----------
config_file : `str`
Name of the configuration file.
log_level : `str`
Per-component logging levels, each item in the list is a tuple
(component, level), ``component`` is a logger name or an empty string
or `None` for root logger, ``level`` is a logging level name, one of
CRITICAL, ERROR, WARNING, INFO, DEBUG (case insensitive).
Returns
-------
Expand All @@ -44,8 +38,6 @@ def _prepare(config_file, log_level, **kwargs):
Representation of the abstract/scientific workflow specific to a given
workflow management system.
"""
if log_level is not None:
CliLog.setLogLevels(log_level)
config = BpsConfig(config_file, BPS_SEARCH_ORDER)
workflow = create_submission(config)
print(f"Submit dir: {workflow.submit_path}")
Expand Down
11 changes: 1 addition & 10 deletions python/lsst/ctrl/bps/cli/script/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from lsst.daf.butler.cli.cliLog import CliLog
from lsst.utils import doImport
from ...report import print_headers, print_run, print_single_run_summary


def _report(log_level, wms_service, user, run_id, hist_days, pass_thru):
def _report(wms_service, user, run_id, hist_days, pass_thru):
"""Print out summary of jobs submitted for execution.
Parameters
----------
log_level : `str`
Per-component logging levels, each item in the list is a tuple
(component, level), ``component`` is a logger name or an empty string
or `None` for root logger, ``level`` is a logging level name, one of
CRITICAL, ERROR, WARNING, INFO, DEBUG (case insensitive).
wms_service : `str`
Name of the class.
user : `str`
Expand All @@ -44,9 +38,6 @@ def _report(log_level, wms_service, user, run_id, hist_days, pass_thru):
pass_thru : `str`
A string to pass directly to the WMS service class.
"""
if log_level is not None:
CliLog.setLogLevels(log_level)

wms_service_class = doImport(wms_service)
wms_service = wms_service_class({})

Expand Down
10 changes: 1 addition & 9 deletions python/lsst/ctrl/bps/cli/script/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from lsst.daf.butler.cli.cliLog import CliLog
from ...submit import submit


def _submit(config, workflow, log_level, **kwargs):
def _submit(config, workflow, **kwargs):
"""Submit workflow for execution.
Parameters
Expand All @@ -32,13 +31,6 @@ def _submit(config, workflow, log_level, **kwargs):
workflow : `lsst.ctrl.bps.wms_workflow.BaseWmsWorkflow`
Representation of the abstract/scientific workflow specific to a given
workflow management system.
log_level : `list` of `tuple`
Per-component logging levels, each item in the list is a tuple
(component, level), ``component`` is a logger name or an empty string
or `None` for root logger, ``level`` is a logging level name, one of
CRITICAL, ERROR, WARNING, INFO, DEBUG (case insensitive).
"""
if log_level is not None:
CliLog.setLogLevels(log_level)
submit(config, workflow)
print(f"Run Id: {workflow.run_id}")

0 comments on commit d34a055

Please sign in to comment.