test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Static Public Attributes
cmsHarvester.CMSHarvester Class Reference

CMSHarvester class. More...

Inheritance diagram for cmsHarvester.CMSHarvester:

Public Member Functions

def __init__
 
def cleanup
 
def config_file_header
 
def db_account_name_cms_cond_dqm_summary
 
def db_account_name_cms_cond_globaltag
 
def format_conditions_string
 
def ident_string
 
def option_handler_book_keeping_file
 
def option_handler_debug
 
def option_handler_force
 
def option_handler_frontier_connection
 
def option_handler_globaltag
 
def option_handler_harvesting_mode
 
def option_handler_harvesting_type
 
def option_handler_input_Jsonfile
 
def option_handler_input_Jsonrunfile
 
def option_handler_input_spec
 
def option_handler_input_todofile
 
def option_handler_no_ref_hists
 
def option_handler_quiet
 
def option_handler_ref_hist_mapping_file
 
def set_output_level
 
def time_stamp
 

Public Attributes

 book_keeping_file_name
 
 force_running
 
 frontier_connection_name
 
 frontier_connection_overridden
 
 globaltag
 
 harvesting_info
 
 harvesting_mode
 
 harvesting_mode_default
 
 harvesting_modes
 
 harvesting_type
 
 harvesting_types
 
 input_method
 
 input_name
 
 Jsonfilename
 
 Jsonrunfilename
 
 log_level
 
 ref_hist_mappings_file_name
 
 todofile
 
 use_ref_hists
 
 version
 

Static Public Attributes

list cmd_line_opts = sys.argv[1:]
 
tuple log_formatter = logging.Formatter("%(message)s")
 
tuple log_handler = logging.StreamHandler()
 
tuple logger = logging.getLogger()
 

Detailed Description

CMSHarvester class.

Class to perform CMS harvesting.

More documentation `obviously' to follow.

Definition at line 293 of file cmsHarvester.py.

Constructor & Destructor Documentation

def cmsHarvester.CMSHarvester.__init__ (   self,
  cmd_line_opts = None 
)

Definition at line 302 of file cmsHarvester.py.

303  def __init__(self, cmd_line_opts=None):
304  "Initialize class and process command line options."
306  self.version = __version__
307 
308  # These are the harvesting types allowed. See the head of this
309  # file for more information.
310  self.harvesting_types = [
311  "RelVal",
312  "RelValFS",
313  "MC",
314  "DQMOffline",
315  ]
316 
317  # These are the possible harvesting modes:
318  # - Single-step: harvesting takes place on-site in a single
319  # step. For each samples only a single ROOT file containing
320  # the harvesting results is returned.
321  # - Single-step-allow-partial: special hack to allow
322  # harvesting of partial statistics using single-step
323  # harvesting on spread-out samples.
324  # - Two-step: harvesting takes place in two steps. The first
325  # step returns a series of monitoring elenent summaries for
326  # each sample. The second step then merges these summaries
327  # locally and does the real harvesting. This second step
328  # produces the ROOT file containing the harvesting results.
329  self.harvesting_modes = [
330  "single-step",
331  "single-step-allow-partial",
332  "two-step"
333  ]
334 
335  # It is possible to specify a GlobalTag that will override any
336  # choices (regarding GlobalTags) made by the cmsHarvester.
337  # BUG BUG BUG
338  # For the moment, until I figure out a way to obtain the
339  # GlobalTag with which a given data (!) dataset was created,
340  # it is necessary to specify a GlobalTag for harvesting of
341  # data.
342  # BUG BUG BUG end
343  self.globaltag = None
344 
345  # It's also possible to switch off the use of reference
346  # histograms altogether.
347  self.use_ref_hists = True
348 
349  # The database name and account are hard-coded. They are not
350  # likely to change before the end-of-life of this tool. But of
351  # course there is a way to override this from the command
352  # line. One can even override the Frontier connection used for
353  # the GlobalTag and for the reference histograms
354  # independently. Please only use this for testing purposes.
355  self.frontier_connection_name = {}
356  self.frontier_connection_name["globaltag"] = "frontier://" \
357  "FrontierProd/"
358  self.frontier_connection_name["refhists"] = "frontier://" \
359  "FrontierProd/"
361  for key in self.frontier_connection_name.keys():
362  self.frontier_connection_overridden[key] = False
363 
364  # This contains information specific to each of the harvesting
365  # types. Used to create the harvesting configuration. It is
366  # filled by setup_harvesting_info().
367  self.harvesting_info = None
368 
369  ###
370 
371  # These are default `unused' values that will be filled in
372  # depending on the command line options.
373 
374  # The type of harvesting we're doing. See
375  # self.harvesting_types for allowed types.
376  self.harvesting_type = None
377 
378  # The harvesting mode, popularly known as single-step
379  # vs. two-step. The thing to remember at this point is that
380  # single-step is only possible for samples located completely
381  # at a single site (i.e. SE).
382  self.harvesting_mode = None
383  # BUG BUG BUG
384  # Default temporarily set to two-step until we can get staged
385  # jobs working with CRAB.
386  self.harvesting_mode_default = "single-step"
387  # BUG BUG BUG end
388 
389  # The input method: are we reading a dataset name (or regexp)
390  # directly from the command line or are we reading a file
391  # containing a list of dataset specifications. Actually we
392  # keep one of each for both datasets and runs.
393  self.input_method = {}
394  self.input_method["datasets"] = {}
395  self.input_method["datasets"]["use"] = None
396  self.input_method["datasets"]["ignore"] = None
397  self.input_method["runs"] = {}
398  self.input_method["runs"]["use"] = None
399  self.input_method["runs"]["ignore"] = None
400  self.input_method["runs"]["ignore"] = None
401  # The name of whatever input we're using.
402  self.input_name = {}
403  self.input_name["datasets"] = {}
404  self.input_name["datasets"]["use"] = None
405  self.input_name["datasets"]["ignore"] = None
406  self.input_name["runs"] = {}
407  self.input_name["runs"]["use"] = None
408  self.input_name["runs"]["ignore"] = None

Member Function Documentation

def cmsHarvester.CMSHarvester.cleanup (   self)

Definition at line 506 of file cmsHarvester.py.

Referenced by esMonitoring.FDJsonServer.handle_close().

507  def cleanup(self):
508  "Clean up after ourselves."
509 
510  # NOTE: This is the safe replacement of __del__.
511 
512  #self.logger.debug("All done -> shutting down")
513  logging.shutdown()
514 
515  # End of cleanup.
def cmsHarvester.CMSHarvester.config_file_header (   self)

Definition at line 600 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.ident_string(), join(), and cmsHarvester.CMSHarvester.time_stamp().

601  def config_file_header(self):
602  "Create a nice header to be used to mark the generated files."
603 
604  tmp = []
605 
606  time_stamp = self.time_stamp()
607  ident_str = self.ident_string()
608  tmp.append("# %s" % time_stamp)
609  tmp.append("# WARNING: This file was created automatically!")
610  tmp.append("")
611  tmp.append("# Created by %s" % ident_str)
612 
613  header = "\n".join(tmp)
614 
615  # End of config_file_header.
616  return header
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def cmsHarvester.CMSHarvester.db_account_name_cms_cond_dqm_summary (   self)
See db_account_name_cms_cond_globaltag.

Definition at line 585 of file cmsHarvester.py.

References cmsPerfSuite.PerfSuite.cmssw_version.

587  """See db_account_name_cms_cond_globaltag."""
588 
589  account_name = None
590  version = self.cmssw_version[6:11]
591  if version < "3_4_0":
592  account_name = "CMS_COND_31X_DQM_SUMMARY"
593  else:
594  account_name = "CMS_COND_34X"
595 
596  # End of db_account_name_cms_cond_dqm_summary.
597  return account_name
def cmsHarvester.CMSHarvester.db_account_name_cms_cond_globaltag (   self)
Return the database account name used to store the GlobalTag.

The name of the database account depends (albeit weakly) on
the CMSSW release version.

Definition at line 568 of file cmsHarvester.py.

570  """Return the database account name used to store the GlobalTag.
571 
572  The name of the database account depends (albeit weakly) on
573  the CMSSW release version.
574 
575  """
576 
577  # This never changed, unlike the cms_cond_31X_DQM_SUMMARY ->
578  # cms_cond_34X_DQM transition.
579  account_name = "CMS_COND_31X_GLOBALTAG"
580 
581  # End of db_account_name_cms_cond_globaltag.
582  return account_name
def cmsHarvester.CMSHarvester.format_conditions_string (   self,
  globaltag 
)
Create the conditions string needed for `cmsDriver'.

Just glueing the FrontierConditions bit in front of it really.

Definition at line 543 of file cmsHarvester.py.

References spr.find().

544  def format_conditions_string(self, globaltag):
545  """Create the conditions string needed for `cmsDriver'.
546 
547  Just glueing the FrontierConditions bit in front of it really.
548 
549  """
550 
551  # Not very robust but okay. The idea is that if the user
552  # specified (since this cannot happen with GlobalTags coming
553  # from DBS) something containing `conditions', they probably
554  # know what they're doing and we should not muck things up. In
555  # all other cases we just assume we only received the
556  # GlobalTag part and we built the usual conditions string from
557  # that .
558  if globaltag.lower().find("conditions") > -1:
559  conditions_string = globaltag
560  else:
561  conditions_string = "FrontierConditions_GlobalTag,%s" % \
562  globaltag
563 
564  # End of format_conditions_string.
565  return conditions_string
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
def cmsHarvester.CMSHarvester.ident_string (   self)

Definition at line 531 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.config_file_header().

532  def ident_string(self):
533  "Spit out an identification string for cmsHarvester.py."
534 
535  ident_str = "`cmsHarvester.py " \
536  "version %s': cmsHarvester.py %s" % \
537  (__version__,
538  reduce(lambda x, y: x+' '+y, sys.argv[1:]))
539 
540  return ident_str
def cmsHarvester.CMSHarvester.option_handler_book_keeping_file (   self,
  option,
  opt_str,
  value,
  parser 
)
Store the name of the file to be used for book keeping.

The only check done here is that only a single book keeping
file is specified.

Definition at line 960 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.book_keeping_file_name.

961  def option_handler_book_keeping_file(self, option, opt_str, value, parser):
962  """Store the name of the file to be used for book keeping.
963 
964  The only check done here is that only a single book keeping
965  file is specified.
966 
967  """
968 
969  file_name = value
970 
971  if not self.book_keeping_file_name is None:
972  msg = "Only one book keeping file should be specified"
973  self.logger.fatal(msg)
974  raise Usage(msg)
975  self.book_keeping_file_name = file_name
976 
977  self.logger.info("Book keeping file to be used: `%s'" % \
979 
980  # End of option_handler_book_keeping_file.
Helper class: Usage exception.
def cmsHarvester.CMSHarvester.option_handler_debug (   self,
  option,
  opt_str,
  value,
  parser 
)
Switch to debug mode.

This both increases the amount of output generated, as well as
changes the format used (more detailed information is given).

Definition at line 658 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.set_output_level().

659  def option_handler_debug(self, option, opt_str, value, parser):
660  """Switch to debug mode.
661 
662  This both increases the amount of output generated, as well as
663  changes the format used (more detailed information is given).
664 
665  """
666 
667  # Switch to a more informative log formatter for debugging.
668  log_formatter_debug = logging.Formatter("[%(levelname)s] " \
669  # NOTE: funcName was
670  # only implemented
671  # starting with python
672  # 2.5.
673  #"%(funcName)s() " \
674  #"@%(filename)s:%(lineno)d " \
675  "%(message)s")
676  # Hmmm, not very nice. This assumes there's only a single
677  # handler associated with the current logger.
678  log_handler = self.logger.handlers[0]
679  log_handler.setFormatter(log_formatter_debug)
680  self.set_output_level("DEBUG")
681 
682  # End of option_handler_debug.
def cmsHarvester.CMSHarvester.option_handler_force (   self,
  option,
  opt_str,
  value,
  parser 
)
Switch on `force mode' in which case we don't brake for nobody.

In so-called `force mode' all sanity checks are performed but
we don't halt on failure. Of course this requires some care
from the user.

Definition at line 694 of file cmsHarvester.py.

695  def option_handler_force(self, option, opt_str, value, parser):
696  """Switch on `force mode' in which case we don't brake for nobody.
697 
698  In so-called `force mode' all sanity checks are performed but
699  we don't halt on failure. Of course this requires some care
700  from the user.
701 
702  """
703 
704  self.logger.debug("Switching on `force mode'.")
705  self.force_running = True
706 
707  # End of option_handler_force.
def cmsHarvester.CMSHarvester.option_handler_frontier_connection (   self,
  option,
  opt_str,
  value,
  parser 
)
Override the default Frontier connection string.

Please only use this for testing (e.g. when a test payload has
been inserted into cms_orc_off instead of cms_orc_on).

This method gets called for three different command line
options:
- --frontier-connection,
- --frontier-connection-for-globaltag,
- --frontier-connection-for-refhists.
Appropriate care has to be taken to make sure things are only
specified once.

Definition at line 822 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.frontier_connection_name, and cmsHarvester.CMSHarvester.frontier_connection_overridden.

Referenced by cmsHarvester.CMSHarvester.option_handler_no_ref_hists().

823  value, parser):
824  """Override the default Frontier connection string.
825 
826  Please only use this for testing (e.g. when a test payload has
827  been inserted into cms_orc_off instead of cms_orc_on).
828 
829  This method gets called for three different command line
830  options:
831  - --frontier-connection,
832  - --frontier-connection-for-globaltag,
833  - --frontier-connection-for-refhists.
834  Appropriate care has to be taken to make sure things are only
835  specified once.
836 
837  """
838 
839  # Figure out with which command line option we've been called.
840  frontier_type = opt_str.split("-")[-1]
841  if frontier_type == "connection":
842  # Main option: change all connection strings.
843  frontier_types = self.frontier_connection_name.keys()
844  else:
845  frontier_types = [frontier_type]
846 
847  # Make sure that each Frontier connection is specified only
848  # once. (Okay, in a bit of a dodgy way...)
849  for connection_name in frontier_types:
850  if self.frontier_connection_overridden[connection_name] == True:
851  msg = "Please specify either:\n" \
852  " `--frontier-connection' to change the " \
853  "Frontier connection used for everything, or\n" \
854  "either one or both of\n" \
855  " `--frontier-connection-for-globaltag' to " \
856  "change the Frontier connection used for the " \
857  "GlobalTag and\n" \
858  " `--frontier-connection-for-refhists' to change " \
859  "the Frontier connection used for the " \
860  "reference histograms."
861  self.logger.fatal(msg)
862  raise Usage(msg)
863 
864  frontier_prefix = "frontier://"
865  if not value.startswith(frontier_prefix):
866  msg = "Expecting Frontier connections to start with " \
867  "`%s'. You specified `%s'." % \
868  (frontier_prefix, value)
869  self.logger.fatal(msg)
870  raise Usage(msg)
871  # We also kind of expect this to be either FrontierPrep or
872  # FrontierProd (but this is just a warning).
873  if value.find("FrontierProd") < 0 and \
874  value.find("FrontierProd") < 0:
875  msg = "Expecting Frontier connections to contain either " \
876  "`FrontierProd' or `FrontierPrep'. You specified " \
877  "`%s'. Are you sure?" % \
878  value
879  self.logger.warning(msg)
880 
881  if not value.endswith("/"):
882  value += "/"
883 
884  for connection_name in frontier_types:
885  self.frontier_connection_name[connection_name] = value
886  self.frontier_connection_overridden[connection_name] = True
887 
888  frontier_type_str = "unknown"
889  if connection_name == "globaltag":
890  frontier_type_str = "the GlobalTag"
891  elif connection_name == "refhists":
892  frontier_type_str = "the reference histograms"
893 
894  self.logger.warning("Overriding default Frontier " \
895  "connection for %s " \
896  "with `%s'" % \
897  (frontier_type_str,
898  self.frontier_connection_name[connection_name]))
899 
900  # End of option_handler_frontier_connection
Helper class: Usage exception.
def cmsHarvester.CMSHarvester.option_handler_globaltag (   self,
  option,
  opt_str,
  value,
  parser 
)
Set the GlobalTag to be used, overriding our own choices.

By default the cmsHarvester will use the GlobalTag with which
a given dataset was created also for the harvesting. The
--globaltag option is the way to override this behaviour.

Definition at line 787 of file cmsHarvester.py.

References alignment.Alignment.globaltag, and cmsHarvester.CMSHarvester.globaltag.

788  def option_handler_globaltag(self, option, opt_str, value, parser):
789  """Set the GlobalTag to be used, overriding our own choices.
790 
791  By default the cmsHarvester will use the GlobalTag with which
792  a given dataset was created also for the harvesting. The
793  --globaltag option is the way to override this behaviour.
794 
795  """
796 
797  # Make sure that this flag only occurred once.
798  if not self.globaltag is None:
799  msg = "Only one GlobalTag should be specified"
800  self.logger.fatal(msg)
801  raise Usage(msg)
802  self.globaltag = value
803 
804  self.logger.info("GlobalTag to be used: `%s'" % \
805  self.globaltag)
806 
807  # End of option_handler_globaltag.
Helper class: Usage exception.
def cmsHarvester.CMSHarvester.option_handler_harvesting_mode (   self,
  option,
  opt_str,
  value,
  parser 
)
Set the harvesting mode to be used.

Single-step harvesting can be used for samples that are
located completely at a single site (= SE). Otherwise use
two-step mode.

Definition at line 754 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.harvesting_mode, cmsHarvester.CMSHarvester.harvesting_modes, and join().

755  def option_handler_harvesting_mode(self, option, opt_str, value, parser):
756  """Set the harvesting mode to be used.
757 
758  Single-step harvesting can be used for samples that are
759  located completely at a single site (= SE). Otherwise use
760  two-step mode.
761 
762  """
763 
764  # Check for valid mode.
765  harvesting_mode = value.lower()
766  if not harvesting_mode in self.harvesting_modes:
767  msg = "Unknown harvesting mode `%s'" % harvesting_mode
768  self.logger.fatal(msg)
769  self.logger.fatal(" possible modes are: %s" % \
770  ", ".join(self.harvesting_modes))
771  raise Usage(msg)
772 
773  # Check if we've been given only a single mode, otherwise
774  # complain.
775  if not self.harvesting_mode is None:
776  msg = "Only one harvesting mode should be specified"
777  self.logger.fatal(msg)
778  raise Usage(msg)
779  self.harvesting_mode = harvesting_mode
780 
781  self.logger.info("Harvesting mode to be used: `%s'" % \
782  self.harvesting_mode)
783 
784  # End of option_handler_harvesting_mode.
Helper class: Usage exception.
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def cmsHarvester.CMSHarvester.option_handler_harvesting_type (   self,
  option,
  opt_str,
  value,
  parser 
)
Set the harvesting type to be used.

This checks that no harvesting type is already set, and sets
the harvesting type to be used to the one specified. If a
harvesting type is already set an exception is thrown. The
same happens when an unknown type is specified.

Definition at line 710 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.harvesting_type, cmsHarvester.CMSHarvester.harvesting_types, and join().

711  def option_handler_harvesting_type(self, option, opt_str, value, parser):
712  """Set the harvesting type to be used.
713 
714  This checks that no harvesting type is already set, and sets
715  the harvesting type to be used to the one specified. If a
716  harvesting type is already set an exception is thrown. The
717  same happens when an unknown type is specified.
718 
719  """
720 
721  # Check for (in)valid harvesting types.
722  # NOTE: The matching is done in a bit of a complicated
723  # way. This allows the specification of the type to be
724  # case-insensitive while still ending up with the properly
725  # `cased' version afterwards.
726  value = value.lower()
727  harvesting_types_lowered = [i.lower() for i in self.harvesting_types]
728  try:
729  type_index = harvesting_types_lowered.index(value)
730  # If this works, we now have the index to the `properly
731  # cased' version of the harvesting type.
732  except ValueError:
733  self.logger.fatal("Unknown harvesting type `%s'" % \
734  value)
735  self.logger.fatal(" possible types are: %s" %
736  ", ".join(self.harvesting_types))
737  raise Usage("Unknown harvesting type `%s'" % \
738  value)
739 
740  # Check if multiple (by definition conflicting) harvesting
741  # types are being specified.
742  if not self.harvesting_type is None:
743  msg = "Only one harvesting type should be specified"
744  self.logger.fatal(msg)
745  raise Usage(msg)
746  self.harvesting_type = self.harvesting_types[type_index]
747 
748  self.logger.info("Harvesting type to be used: `%s'" % \
749  self.harvesting_type)
750 
751  # End of option_handler_harvesting_type.
Helper class: Usage exception.
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def cmsHarvester.CMSHarvester.option_handler_input_Jsonfile (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 910 of file cmsHarvester.py.

911  def option_handler_input_Jsonfile(self, option, opt_str, value, parser):
913  self.Jsonfilename = value
914  # End of option_handler_input_Jsonfile.
def cmsHarvester.CMSHarvester.option_handler_input_Jsonrunfile (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 917 of file cmsHarvester.py.

918  def option_handler_input_Jsonrunfile(self, option, opt_str, value, parser):
920  self.Jsonrunfilename = value
921  # End of option_handler_input_Jsonrunfile.
def cmsHarvester.CMSHarvester.option_handler_input_spec (   self,
  option,
  opt_str,
  value,
  parser 
)
TODO TODO TODO
Document this...

Definition at line 924 of file cmsHarvester.py.

References spr.find(), cmsHarvester.CMSHarvester.input_method, cmsHarvester.CMSHarvester.input_name, and python.rootplot.root2matplotlib.replace().

925  def option_handler_input_spec(self, option, opt_str, value, parser):
926  """TODO TODO TODO
927  Document this...
928 
929  """
930 
931  # Figure out if we were called for the `use these' or the
932  # `ignore these' case.
933  if opt_str.lower().find("ignore") > -1:
934  spec_type = "ignore"
935  else:
936  spec_type = "use"
937 
938  # Similar: are we being called for datasets or for runs?
939  if opt_str.lower().find("dataset") > -1:
940  select_type = "datasets"
941  else:
942  select_type = "runs"
943 
944  if not self.input_method[select_type][spec_type] is None:
945  msg = "Please only specify one input method " \
946  "(for the `%s' case)" % opt_str
947  self.logger.fatal(msg)
948  raise Usage(msg)
949 
950  input_method = opt_str.replace("-", "").replace("ignore", "")
951  self.input_method[select_type][spec_type] = input_method
952  self.input_name[select_type][spec_type] = value
953 
954  self.logger.debug("Input method for the `%s' case: %s" % \
955  (spec_type, input_method))
956 
957  # End of option_handler_input_spec
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
Helper class: Usage exception.
def cmsHarvester.CMSHarvester.option_handler_input_todofile (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 903 of file cmsHarvester.py.

904  def option_handler_input_todofile(self, option, opt_str, value, parser):
906  self.todofile = value
907  # End of option_handler_input_todofile.
def cmsHarvester.CMSHarvester.option_handler_no_ref_hists (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 810 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.option_handler_frontier_connection(), and cmsHarvester.CMSHarvester.use_ref_hists.

811  def option_handler_no_ref_hists(self, option, opt_str, value, parser):
812  "Switch use of all reference histograms off."
813 
814  self.use_ref_hists = False
815 
816  self.logger.warning("Switching off all use of reference histograms")
817 
818  # End of option_handler_no_ref_hists.
819 
820  ##########
def cmsHarvester.CMSHarvester.option_handler_quiet (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 685 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.set_output_level().

686  def option_handler_quiet(self, option, opt_str, value, parser):
687  "Switch to quiet mode: less verbose."
688 
689  self.set_output_level("QUIET")
690 
691  # End of option_handler_quiet.
def cmsHarvester.CMSHarvester.option_handler_ref_hist_mapping_file (   self,
  option,
  opt_str,
  value,
  parser 
)
Store the name of the file for the ref. histogram mapping.

Definition at line 983 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.ref_hist_mappings_file_name.

984  def option_handler_ref_hist_mapping_file(self, option, opt_str, value, parser):
985  """Store the name of the file for the ref. histogram mapping.
986 
987  """
988 
989  file_name = value
990 
991  if not self.ref_hist_mappings_file_name is None:
992  msg = "Only one reference histogram mapping file " \
993  "should be specified"
994  self.logger.fatal(msg)
995  raise Usage(msg)
996  self.ref_hist_mappings_file_name = file_name
997 
998  self.logger.info("Reference histogram mapping file " \
999  "to be used: `%s'" % \
1001 
1002  # End of option_handler_ref_hist_mapping_file.
Helper class: Usage exception.
def cmsHarvester.CMSHarvester.set_output_level (   self,
  output_level 
)
Adjust the level of output generated.

Choices are:
  - normal  : default level of output
  - quiet   : less output than the default
  - verbose : some additional information
  - debug   : lots more information, may be overwhelming

NOTE: The debug option is a bit special in the sense that it
      also modifies the output format.

Definition at line 619 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_debug(), and cmsHarvester.CMSHarvester.option_handler_quiet().

620  def set_output_level(self, output_level):
621  """Adjust the level of output generated.
622 
623  Choices are:
624  - normal : default level of output
625  - quiet : less output than the default
626  - verbose : some additional information
627  - debug : lots more information, may be overwhelming
628 
629  NOTE: The debug option is a bit special in the sense that it
630  also modifies the output format.
631 
632  """
633 
634  # NOTE: These levels are hooked up to the ones used in the
635  # logging module.
636  output_levels = {
637  "NORMAL" : logging.INFO,
638  "QUIET" : logging.WARNING,
639  "VERBOSE" : logging.INFO,
640  "DEBUG" : logging.DEBUG
641  }
642 
643  output_level = output_level.upper()
644 
645  try:
646  # Update the logger.
647  self.log_level = output_levels[output_level]
648  self.logger.setLevel(self.log_level)
649  except KeyError:
650  # Show a complaint
651  self.logger.fatal("Unknown output level `%s'" % ouput_level)
652  # and re-raise an exception.
653  raise Exception
654 
655  # End of set_output_level.
def cmsHarvester.CMSHarvester.time_stamp (   self)

Definition at line 518 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.config_file_header().

519  def time_stamp(self):
520  "Create a timestamp to use in the created config files."
521 
522  time_now = datetime.datetime.utcnow()
523  # We don't care about the microseconds.
524  time_now = time_now.replace(microsecond = 0)
525  time_stamp = "%sUTC" % datetime.datetime.isoformat(time_now)
526 
527  # End of time_stamp.
528  return time_stamp

Member Data Documentation

cmsHarvester.CMSHarvester.book_keeping_file_name

Definition at line 974 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_book_keeping_file().

list cmsHarvester.CMSHarvester.cmd_line_opts = sys.argv[1:]
static

Definition at line 484 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.force_running

Definition at line 704 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.frontier_connection_name

Definition at line 354 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_frontier_connection().

cmsHarvester.CMSHarvester.frontier_connection_overridden

Definition at line 359 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_frontier_connection().

cmsHarvester.CMSHarvester.globaltag

Definition at line 342 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_globaltag().

cmsHarvester.CMSHarvester.harvesting_info

Definition at line 366 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.harvesting_mode

Definition at line 381 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_mode().

cmsHarvester.CMSHarvester.harvesting_mode_default

Definition at line 385 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.harvesting_modes

Definition at line 328 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_mode().

cmsHarvester.CMSHarvester.harvesting_type

Definition at line 375 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_type().

cmsHarvester.CMSHarvester.harvesting_types

Definition at line 309 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_type().

cmsHarvester.CMSHarvester.input_method

Definition at line 392 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_input_spec().

cmsHarvester.CMSHarvester.input_name

Definition at line 401 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_input_spec().

cmsHarvester.CMSHarvester.Jsonfilename

Definition at line 912 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.Jsonrunfilename

Definition at line 919 of file cmsHarvester.py.

tuple cmsHarvester.CMSHarvester.log_formatter = logging.Formatter("%(message)s")
static

Definition at line 491 of file cmsHarvester.py.

tuple cmsHarvester.CMSHarvester.log_handler = logging.StreamHandler()
static

Definition at line 488 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.log_level

Definition at line 646 of file cmsHarvester.py.

tuple cmsHarvester.CMSHarvester.logger = logging.getLogger()
static

Definition at line 493 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.ref_hist_mappings_file_name

Definition at line 995 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_ref_hist_mapping_file().

cmsHarvester.CMSHarvester.todofile

Definition at line 905 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.use_ref_hists

Definition at line 346 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_no_ref_hists().

cmsHarvester.CMSHarvester.version

Definition at line 305 of file cmsHarvester.py.

Referenced by python.rootplot.argparse._VersionAction.__call__(), validation.Sample.datasetpattern(), validation.Sample.filename(), argparse.ArgumentParser.format_version(), and python.rootplot.argparse.ArgumentParser.format_version().