CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DTT0WireWorkflow.py
Go to the documentation of this file.
1 import os
2 import logging
3 
4 import tools
5 import FWCore.ParameterSet.Config as cms
6 from DTWorkflow import DTWorkflow
7 
8 log = logging.getLogger(__name__)
9 
11  """ This class creates and performce / submits vdrift workflow jobs"""
12  def __init__(self, options):
13  # call parent constructor
14  super(DTT0WireWorkflow, self).__init__(options)
15 
16  self.outpath_command_tag = "T0WireCalibration"
17  self.outpath_workflow_mode_dict = {"all" : "All"}
18  self.output_file = 'DTTestPulses.root'
19  self.output_files = ['t0.db', self.output_file, 'DQM.root']
20 
21  def prepare_workflow(self):
22  """ Generalized function to prepare workflow dependent on workflow mode"""
23  function_name = "prepare_" + self.options.workflow_mode + "_" + self.options.command
24 
25  try:
26  fill_function = getattr(self, function_name)
27  except AttributeError:
28  errmsg = "Class `{}` does not implement `{}`"
29  raise NotImplementedError(errmsg.format(my_cls.__class__.__name__,
30  method_name))
31  log.debug("Preparing workflow with function %s" % function_name)
32  # call chosen function
33  fill_function()
34 
35  def prepare_all_submit(self):
36  self.pset_name = 'dtT0WireCalibration_cfg.py'
37  self.pset_template = 'CalibMuon.DTCalibration.dtT0WireCalibration_cfg'
38 
40  self.process.GlobalTag.globaltag = self.options.globaltag
41  self.process.dtT0WireCalibration.rootFileName = self.output_file
42 
44  self.write_pset_file()
45 
46  def prepare_all_all(self):
47  # individual prepare functions for all tasks will be called in
48  # main implementation of all
49  self.all_commands=["submit"]
50 
51  def submit(self):
52  # Overload to run locally
53  self.runCMSSWtask()
54 
55  ####################################################################
56  # CLI creation #
57  ####################################################################
58  @classmethod
59  def add_parser_options(cls, subparser_container):
60  vdrift_parser = subparser_container.add_parser( "T0Wire",
61  #parents=[mutual_parent_parser, common_parent_parser],
62  help = "" ) # What does ttrig
63 
64  ################################################################
65  # Sub parser options for workflow modes #
66  ################################################################
67  vdrift_subparsers = vdrift_parser.add_subparsers( dest="workflow_mode",
68  help="Possible workflow modes",)
69  ## Add all workflow modes for ttrig
70  vdrift_segment_subparser = vdrift_subparsers.add_parser( "all",
71  #parents=[mutual_parent_parser, common_parent_parser],
72  help = "" )
73  ################################################################
74  # Sub parser options for workflow mode segment #
75  ################################################################
76  vdrift_segment_subparsers = vdrift_segment_subparser.add_subparsers( dest="command",
77  help="Possible commands for all")
78  vdrift_segment_submit_parser = vdrift_segment_subparsers.add_parser(
79  "submit",
80  parents=[super(DTT0WireWorkflow,cls).get_common_options_parser(),
81  super(DTT0WireWorkflow,cls).get_submission_options_parser(),
82  super(DTT0WireWorkflow,cls).get_local_input_db_options_parser(),
83  super(DTT0WireWorkflow,cls).get_input_db_options_parser()],
84  help = "Run job locally as GRID submission is not supported for T0 Calibration")
85 
86  vdrift_segment_all_parser = vdrift_segment_subparsers.add_parser(
87  "all",
88  parents=[super(DTT0WireWorkflow,cls).get_common_options_parser(),
89  super(DTT0WireWorkflow,cls).get_submission_options_parser(),
90  super(DTT0WireWorkflow,cls).get_input_db_options_parser(),
91  super(DTT0WireWorkflow,cls).get_local_input_db_options_parser(),
92  ],
93  help = "Perform all steps: submit, check in this order")
def add_parser_options
CLI creation #.
def loadCmsProcess
Definition: tools.py:56