CMS 3D CMS Logo

CLIHelper.py
Go to the documentation of this file.
1 import os
2 import argparse
4  @classmethod
6  """ Return a parser with common options for each workflow"""
7  common_opts_parser = argparse.ArgumentParser(add_help=False)
8  common_opts_group = common_opts_parser.add_argument_group(
9  description ="General options")
10  common_opts_group.add_argument("-r","--run", type=int,
11  help="set reference run number (typically first or last run in list)")
12  common_opts_group.add_argument("--trial", type=int, default = 1,
13  help="trial number used in the naming of output directories")
14  common_opts_group.add_argument("--label", default="dtCalibration",
15  help="label used in the naming of workflow output default:%(default)s")
16  common_opts_group.add_argument("--datasettype", default = "Data",
17  choices=["Data", "Cosmics", "MC"], help="Type of input dataset default: %(default)s")
18  common_opts_group.add_argument("--config-path",
19  help="Path to alternative workflow config json file, e.g. used to submit the job")
20  common_opts_group.add_argument("--user", default="",
21  help="User used e.g. for submission. Defaults to user HN name")
22  common_opts_group.add_argument("--working-dir",
23  default=os.getcwd(), help="connect string default:%(default)s")
24  common_opts_group.add_argument("--no-exec",
25  action="store_true", help="Do not execute or submit any workflow")
26  return common_opts_parser
27 
28  @classmethod
29  def add_parser_options(cls, parser):
30  # Subparsers are used to choose a calibration workflow
31  workflow_subparsers = parser.add_subparsers( help="workflow option help", dest="workflow" )
32  return workflow_subparsers
33 
34 
36  common_required = []
37  self.required_options_prepare_dict["submit"] = ["globaltag"]
38 
40  common_required = ["run"]
41  self.required_options_dict["submit"] = common_required
42  self.required_options_dict["submit"].append("datasetpath")
43  self.required_options_dict["submit"].append("globaltag")
44 
45  self.required_options_dict["correction"] = common_required
46  self.required_options_dict["correction"].append("globaltag")
47 
48 
49  @classmethod
51  """ Return a parser object with options relevant for input databases"""
52  db_opts_parser = argparse.ArgumentParser(add_help=False)
53  dp_opts_group = db_opts_parser.add_argument_group(
54  description ="Options for Input databases")
55  db_opts_parser.add_argument("--inputDBRcd",
56  help="Record used for PoolDBESSource")
57  db_opts_parser.add_argument("--inputDBTag",
58  help="Tag used for PoolDBESSource")
59  db_opts_parser.add_argument("--connectStrDBTag",
60  default='frontier://FrontierProd/CMS_COND_31X_DT',
61  help="connect string default:%(default)s")
62  return db_opts_parser
63 
64  @classmethod
66  """ Return a parser object with options relevant for input databases"""
67  db_opts_parser = argparse.ArgumentParser(add_help=False)
68  db_opts_group = db_opts_parser.add_argument_group(
69  description ="Options for local input databases")
70  db_opts_group.add_argument("--inputVDriftDB",
71  help="Local alternative VDrift database")
72  db_opts_group.add_argument("--inputCalibDB",
73  help="Local alternative Ttrig database")
74  db_opts_group.add_argument("--inputT0DB",
75  help="Local alternative T0 database")
76  return db_opts_parser
77 
78  @classmethod
80  """ Return a parser object with options relevant to remote submission"""
81  submission_opts_parser = argparse.ArgumentParser(add_help=False)
82  submission_opts_group = submission_opts_parser.add_argument_group(
83  description ="Options for Job submission")
84  submission_opts_group.add_argument("--datasetpath",
85  help="dataset name to process")
86  submission_opts_group.add_argument("--run-on-RAW", action = "store_true",
87  help="Flag if run on RAW dataset")
88  submission_opts_group.add_argument("--fromMuons", action = "store_true",
89  help="Segment selection using muon-segment matching")
90  submission_opts_group.add_argument("--globaltag",
91  help="global tag identifier (with the '::All' string, if necessary)")
92  submission_opts_group.add_argument("--histoRange", default = 0.4,
93  help="Range or residual histogram, default is 0.4cm")
94  submission_opts_group.add_argument("--runselection", default = [], nargs="+",
95  help="run list or range")
96  submission_opts_group.add_argument("--filesPerJob", default = 5,
97  help="Number of files to process for MC grid jobs")
98  submission_opts_group.add_argument("--lumisPerJob", default = 10000,
99  help="Number of lumi sections to process for RAW / Comsics grid jobs")
100  submission_opts_group.add_argument("--preselection", dest="preselection",
101  help="configuration fragment and sequence name, separated by a ':', defining a pre-selection filter")
102  submission_opts_group.add_argument("--output-site", default = "T2_DE_RWTH",
103  help="Site used for stage out of results")
104  submission_opts_group.add_argument("--ce-black-list", default = [], nargs="+",
105  help="add sites to black list when run on Grid")
106  submission_opts_group.add_argument("--ce-white-list", default = [], nargs="+",
107  help="add sites to white list when run on Grid")
108  submission_opts_group.add_argument("--no-log",
109  action="store_true", help="Do not transfer crab logs:%(default)s")
110  return submission_opts_parser
111 
112  @classmethod
114  """ Return a parser object with options relevant to check the status of remote submission"""
115  check_opts_parser = argparse.ArgumentParser(add_help=False)
116  check_opts_group = check_opts_parser.add_argument_group(
117  description ="Options for Job submission")
118  check_opts_group.add_argument("--check-interval", default = 600,type=int,
119  help="Time in seconds between check operations default: %(default)s")
120  check_opts_group.add_argument("--max-checks", default =1000, type=int,
121  help="Maximum number of checks before check is considered failed default: %(default)s")
122  return check_opts_parser
123 
124  @classmethod
126  """ Return a parser object with options relevant to write results to dbs"""
127  check_opts_parser = argparse.ArgumentParser(add_help=False)
128  check_opts_group = check_opts_parser.add_argument_group(
129  description ="Options for write jobs")
130  check_opts_group.add_argument("--skip-stageout", action="store_true",
131  help="Skip stageout to local disk and merging")
132  return check_opts_parser
133 
134  @classmethod
136  dump_opts_parser = argparse.ArgumentParser(add_help=False)
137  dump_opts_group = dump_opts_parser.add_argument_group(
138  description ="Options for dump db file")
139  dump_opts_group.add_argument("--input-dumpDB",
140  help="Input database file to dump."\
141  " Defaults to existing corrected database from correction command"\
142  " if run, label, trial or input config are specified")
143  return dump_opts_group
144 
CLIHelper.CLIHelper.get_common_options_parser
def get_common_options_parser(cls)
Definition: CLIHelper.py:5
CLIHelper.CLIHelper.add_parser_options
def add_parser_options(cls, parser)
Definition: CLIHelper.py:29
resolutioncreator_cfi.object
object
Definition: resolutioncreator_cfi.py:4
CLIHelper.CLIHelper.get_check_options_parser
def get_check_options_parser(cls)
Definition: CLIHelper.py:113
CLIHelper.CLIHelper.fill_required_options_prepare_dict
def fill_required_options_prepare_dict(self)
Definition: CLIHelper.py:35
CLIHelper.CLIHelper.get_submission_options_parser
def get_submission_options_parser(cls)
Definition: CLIHelper.py:79
mps_setup.append
append
Definition: mps_setup.py:85
CLIHelper.CLIHelper.get_write_options_parser
def get_write_options_parser(cls)
Definition: CLIHelper.py:125
CLIHelper.CLIHelper.get_dump_options_parser
def get_dump_options_parser(cls)
Definition: CLIHelper.py:135
CLIHelper.CLIHelper
Definition: CLIHelper.py:3
CLIHelper.CLIHelper.fill_required_options_dict
def fill_required_options_dict(self)
Definition: CLIHelper.py:39
CLIHelper.CLIHelper.get_input_db_options_parser
def get_input_db_options_parser(cls)
Definition: CLIHelper.py:50
CLIHelper.CLIHelper.get_local_input_db_options_parser
def get_local_input_db_options_parser(cls)
Definition: CLIHelper.py:65