Hide keyboard shortcuts

Hot-keys 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_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 

25from .. import opt 

26from .. import script 

27 

28 

29class BpsCommand(MWCommand): 

30 """Command subclass with bps-command specific overrides.""" 

31 

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

33 

34 

35@click.command(cls=BpsCommand) 

36@opt.config_file_argument(required=True) 

37def transform(*args, **kwargs): 

38 """Transform a quantum graph to a workflow graph. 

39 """ 

40 raise NotImplementedError 

41 

42 

43@click.command(cls=BpsCommand) 

44@opt.config_file_argument(required=True) 

45def prepare(*args, **kwargs): 

46 """Prepare a workflow for submission. 

47 """ 

48 script.prepare(*args, **kwargs) 

49 

50 

51@click.command(cls=BpsCommand) 

52@opt.config_file_argument(required=True) 

53def submit(*args, **kwargs): 

54 """Submit a workflow for execution. 

55 """ 

56 config, workflow = script.prepare(*args, **kwargs) 

57 script.submit(config=config, workflow=workflow, **kwargs) 

58 

59 

60@click.command(cls=BpsCommand) 

61@click.option("--wms", "wms_service", 

62 default="lsst.ctrl.bps.wms.htcondor.htcondor_service.HTCondorService", 

63 help="Workload Management System service class") 

64@click.option("--user", 

65 help="Restrict report to specific user.") 

66@click.option("--id", "run_id", 

67 help="Restrict report to specific WMS run id.") 

68@click.option("--hist", "hist_days", 

69 default=0.0, 

70 help="Search WMS history X days for completed info.") 

71@click.option("--pass-thru", 

72 help="Pass the given string to the WMS service class") 

73def report(*args, **kwargs): 

74 """Display execution status for submitted workflows. 

75 """ 

76 script.report(*args, **kwargs) 

77 

78 

79@click.command(cls=BpsCommand) 

80@click.option("--wms", "wms_service", 

81 default="lsst.ctrl.bps.wms.htcondor.htcondor_service.HTCondorService", 

82 help="Workload Management System service class.") 

83@click.option("--id", "run_id", 

84 help="Run id of workflow to cancel.") 

85@click.option("--user", 

86 help="User for which to cancel all submitted workflows.") 

87@click.option("--require-bps/--skip-require-bps", "require_bps", default=True, show_default=True, 

88 help="Only cancel jobs submitted via bps.") 

89@click.option("--pass-thru", "pass_thru", default=str(), 

90 help="Pass the given string to the WMS service.") 

91def cancel(*args, **kwargs): 

92 """Cancel submitted workflow(s). 

93 """ 

94 script.cli_cancel(*args, **kwargs)