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 

24 

25from lsst.daf.butler.cli.utils import MWCommand 

26from ...drivers import ( 

27 acquire_qgraph_driver, 

28 cluster_qgraph_driver, 

29 transform_driver, 

30 prepare_driver, 

31 submit_driver, 

32 report_driver, 

33 cancel_driver 

34) 

35from .. import opt 

36 

37 

38class BpsCommand(MWCommand): 

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

40 

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

42 

43 

44@click.command(cls=BpsCommand) 

45@opt.config_file_argument(required=True) 

46@opt.SubmissionOptions() 

47def acquire(*args, **kwargs): 

48 """Create a new quantum graph or read existing one from a file. 

49 """ 

50 acquire_qgraph_driver(*args, **kwargs) 

51 

52 

53@click.command(cls=BpsCommand) 

54@opt.config_file_argument(required=True) 

55@opt.SubmissionOptions() 

56def cluster(*args, **kwargs): 

57 """Create a clustered quantum graph. 

58 """ 

59 cluster_qgraph_driver(*args, **kwargs) 

60 

61 

62@click.command(cls=BpsCommand) 

63@opt.config_file_argument(required=True) 

64@opt.SubmissionOptions() 

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

66 """Transform a quantum graph to a generic workflow. 

67 """ 

68 transform_driver(*args, **kwargs) 

69 

70 

71@click.command(cls=BpsCommand) 

72@opt.config_file_argument(required=True) 

73@opt.SubmissionOptions() 

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

75 """Prepare a workflow for submission. 

76 """ 

77 prepare_driver(*args, **kwargs) 

78 

79 

80@click.command(cls=BpsCommand) 

81@opt.config_file_argument(required=True) 

82@opt.SubmissionOptions() 

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

84 """Submit a workflow for execution. 

85 """ 

86 submit_driver(*args, **kwargs) 

87 

88 

89@click.command(cls=BpsCommand) 

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

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

92 help="Workload Management System service class") 

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

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

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

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

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

98 default=0.0, 

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

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

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

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

103 """Display execution status for submitted workflows. 

104 """ 

105 report_driver(*args, **kwargs) 

106 

107 

108@click.command(cls=BpsCommand) 

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

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

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

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

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

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

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

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

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

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

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

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

121 """Cancel submitted workflow(s). 

122 """ 

123 cancel_driver(*args, **kwargs)