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 292 of file cmsHarvester.py.

Constructor & Destructor Documentation

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

Definition at line 301 of file cmsHarvester.py.

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

Member Function Documentation

def cmsHarvester.CMSHarvester.cleanup (   self)

Definition at line 505 of file cmsHarvester.py.

Referenced by esMonitoring.FDJsonServer.handle_close().

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

Definition at line 599 of file cmsHarvester.py.

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

600  def config_file_header(self):
601  "Create a nice header to be used to mark the generated files."
602 
603  tmp = []
604 
605  time_stamp = self.time_stamp()
606  ident_str = self.ident_string()
607  tmp.append("# %s" % time_stamp)
608  tmp.append("# WARNING: This file was created automatically!")
609  tmp.append("")
610  tmp.append("# Created by %s" % ident_str)
611 
612  header = "\n".join(tmp)
613 
614  # End of config_file_header.
615  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 584 of file cmsHarvester.py.

References cmsPerfSuite.PerfSuite.cmssw_version.

586  """See db_account_name_cms_cond_globaltag."""
587 
588  account_name = None
589  version = self.cmssw_version[6:11]
590  if version < "3_4_0":
591  account_name = "CMS_COND_31X_DQM_SUMMARY"
592  else:
593  account_name = "CMS_COND_34X"
594 
595  # End of db_account_name_cms_cond_dqm_summary.
596  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 567 of file cmsHarvester.py.

569  """Return the database account name used to store the GlobalTag.
570 
571  The name of the database account depends (albeit weakly) on
572  the CMSSW release version.
573 
574  """
575 
576  # This never changed, unlike the cms_cond_31X_DQM_SUMMARY ->
577  # cms_cond_34X_DQM transition.
578  account_name = "CMS_COND_31X_GLOBALTAG"
579 
580  # End of db_account_name_cms_cond_globaltag.
581  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 542 of file cmsHarvester.py.

References spr.find().

543  def format_conditions_string(self, globaltag):
544  """Create the conditions string needed for `cmsDriver'.
545 
546  Just glueing the FrontierConditions bit in front of it really.
547 
548  """
549 
550  # Not very robust but okay. The idea is that if the user
551  # specified (since this cannot happen with GlobalTags coming
552  # from DBS) something containing `conditions', they probably
553  # know what they're doing and we should not muck things up. In
554  # all other cases we just assume we only received the
555  # GlobalTag part and we built the usual conditions string from
556  # that .
557  if globaltag.lower().find("conditions") > -1:
558  conditions_string = globaltag
559  else:
560  conditions_string = "FrontierConditions_GlobalTag,%s" % \
561  globaltag
562 
563  # End of format_conditions_string.
564  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 530 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.config_file_header().

531  def ident_string(self):
532  "Spit out an identification string for cmsHarvester.py."
533 
534  ident_str = "`cmsHarvester.py " \
535  "version %s': cmsHarvester.py %s" % \
536  (__version__,
537  reduce(lambda x, y: x+' '+y, sys.argv[1:]))
538 
539  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 959 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.book_keeping_file_name.

960  def option_handler_book_keeping_file(self, option, opt_str, value, parser):
961  """Store the name of the file to be used for book keeping.
962 
963  The only check done here is that only a single book keeping
964  file is specified.
965 
966  """
967 
968  file_name = value
969 
970  if not self.book_keeping_file_name is None:
971  msg = "Only one book keeping file should be specified"
972  self.logger.fatal(msg)
973  raise Usage(msg)
974  self.book_keeping_file_name = file_name
975 
976  self.logger.info("Book keeping file to be used: `%s'" % \
978 
979  # 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 657 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.set_output_level().

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

694  def option_handler_force(self, option, opt_str, value, parser):
695  """Switch on `force mode' in which case we don't brake for nobody.
696 
697  In so-called `force mode' all sanity checks are performed but
698  we don't halt on failure. Of course this requires some care
699  from the user.
700 
701  """
702 
703  self.logger.debug("Switching on `force mode'.")
704  self.force_running = True
705 
706  # 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 821 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().

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

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

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

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

754  def option_handler_harvesting_mode(self, option, opt_str, value, parser):
755  """Set the harvesting mode to be used.
756 
757  Single-step harvesting can be used for samples that are
758  located completely at a single site (= SE). Otherwise use
759  two-step mode.
760 
761  """
762 
763  # Check for valid mode.
764  harvesting_mode = value.lower()
765  if not harvesting_mode in self.harvesting_modes:
766  msg = "Unknown harvesting mode `%s'" % harvesting_mode
767  self.logger.fatal(msg)
768  self.logger.fatal(" possible modes are: %s" % \
769  ", ".join(self.harvesting_modes))
770  raise Usage(msg)
771 
772  # Check if we've been given only a single mode, otherwise
773  # complain.
774  if not self.harvesting_mode is None:
775  msg = "Only one harvesting mode should be specified"
776  self.logger.fatal(msg)
777  raise Usage(msg)
778  self.harvesting_mode = harvesting_mode
779 
780  self.logger.info("Harvesting mode to be used: `%s'" % \
781  self.harvesting_mode)
782 
783  # 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 709 of file cmsHarvester.py.

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

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

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

Definition at line 916 of file cmsHarvester.py.

917  def option_handler_input_Jsonrunfile(self, option, opt_str, value, parser):
919  self.Jsonrunfilename = value
920  # 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 923 of file cmsHarvester.py.

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

924  def option_handler_input_spec(self, option, opt_str, value, parser):
925  """TODO TODO TODO
926  Document this...
927 
928  """
929 
930  # Figure out if we were called for the `use these' or the
931  # `ignore these' case.
932  if opt_str.lower().find("ignore") > -1:
933  spec_type = "ignore"
934  else:
935  spec_type = "use"
936 
937  # Similar: are we being called for datasets or for runs?
938  if opt_str.lower().find("dataset") > -1:
939  select_type = "datasets"
940  else:
941  select_type = "runs"
942 
943  if not self.input_method[select_type][spec_type] is None:
944  msg = "Please only specify one input method " \
945  "(for the `%s' case)" % opt_str
946  self.logger.fatal(msg)
947  raise Usage(msg)
948 
949  input_method = opt_str.replace("-", "").replace("ignore", "")
950  self.input_method[select_type][spec_type] = input_method
951  self.input_name[select_type][spec_type] = value
952 
953  self.logger.debug("Input method for the `%s' case: %s" % \
954  (spec_type, input_method))
955 
956  # 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 902 of file cmsHarvester.py.

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

Definition at line 809 of file cmsHarvester.py.

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

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

Definition at line 684 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.set_output_level().

685  def option_handler_quiet(self, option, opt_str, value, parser):
686  "Switch to quiet mode: less verbose."
687 
688  self.set_output_level("QUIET")
689 
690  # 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 982 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.ref_hist_mappings_file_name.

983  def option_handler_ref_hist_mapping_file(self, option, opt_str, value, parser):
984  """Store the name of the file for the ref. histogram mapping.
985 
986  """
987 
988  file_name = value
989 
990  if not self.ref_hist_mappings_file_name is None:
991  msg = "Only one reference histogram mapping file " \
992  "should be specified"
993  self.logger.fatal(msg)
994  raise Usage(msg)
995  self.ref_hist_mappings_file_name = file_name
996 
997  self.logger.info("Reference histogram mapping file " \
998  "to be used: `%s'" % \
1000 
1001  # 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 618 of file cmsHarvester.py.

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

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

Definition at line 517 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.config_file_header().

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

Member Data Documentation

cmsHarvester.CMSHarvester.book_keeping_file_name

Definition at line 973 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 483 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.force_running

Definition at line 703 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.frontier_connection_name

Definition at line 353 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_frontier_connection().

cmsHarvester.CMSHarvester.frontier_connection_overridden

Definition at line 358 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_frontier_connection().

cmsHarvester.CMSHarvester.globaltag

Definition at line 341 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_globaltag().

cmsHarvester.CMSHarvester.harvesting_info

Definition at line 365 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.harvesting_mode

Definition at line 380 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_mode().

cmsHarvester.CMSHarvester.harvesting_mode_default

Definition at line 384 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.harvesting_modes

Definition at line 327 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_mode().

cmsHarvester.CMSHarvester.harvesting_type

Definition at line 374 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_type().

cmsHarvester.CMSHarvester.harvesting_types

Definition at line 308 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_type().

cmsHarvester.CMSHarvester.input_method

Definition at line 391 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_input_spec().

cmsHarvester.CMSHarvester.input_name

Definition at line 400 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_input_spec().

cmsHarvester.CMSHarvester.Jsonfilename

Definition at line 911 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.Jsonrunfilename

Definition at line 918 of file cmsHarvester.py.

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

Definition at line 490 of file cmsHarvester.py.

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

Definition at line 487 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.log_level

Definition at line 645 of file cmsHarvester.py.

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

Definition at line 492 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.ref_hist_mappings_file_name

Definition at line 994 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_ref_hist_mapping_file().

cmsHarvester.CMSHarvester.todofile

Definition at line 904 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.use_ref_hists

Definition at line 345 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_no_ref_hists().

cmsHarvester.CMSHarvester.version

Definition at line 304 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().