CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
cmsHarvester.CMSHarvester Class Reference

CMSHarvester class. More...

Inheritance diagram for cmsHarvester.CMSHarvester:

Public Member Functions

def __init__ (self, cmd_line_opts=None)
 
def cleanup (self)
 
def config_file_header (self)
 
def db_account_name_cms_cond_dqm_summary (self)
 
def db_account_name_cms_cond_globaltag (self)
 
def format_conditions_string (self, globaltag)
 
def ident_string (self)
 
def option_handler_book_keeping_file (self, option, opt_str, value, parser)
 
def option_handler_debug (self, option, opt_str, value, parser)
 
def option_handler_force (self, option, opt_str, value, parser)
 
def option_handler_frontier_connection (self, option, opt_str, value, parser)
 
def option_handler_globaltag (self, option, opt_str, value, parser)
 
def option_handler_harvesting_mode (self, option, opt_str, value, parser)
 
def option_handler_harvesting_type (self, option, opt_str, value, parser)
 
def option_handler_input_Jsonfile (self, option, opt_str, value, parser)
 
def option_handler_input_Jsonrunfile (self, option, opt_str, value, parser)
 
def option_handler_input_spec (self, option, opt_str, value, parser)
 
def option_handler_input_todofile (self, option, opt_str, value, parser)
 
def option_handler_no_ref_hists (self, option, opt_str, value, parser)
 
def option_handler_quiet (self, option, opt_str, value, parser)
 
def option_handler_ref_hist_mapping_file (self, option, opt_str, value, parser)
 
def set_output_level (self, output_level)
 
def time_stamp (self)
 

Public Attributes

 all_sites_found
 
 book_keeping_file_name
 
 book_keeping_file_name_default
 
 book_keeping_information
 
 caf_access
 
 castor_base_dir
 
 castor_base_dir_default
 
 castor_prefix
 
 cmd_line_opts
 
 crab_submission
 
 datasets_to_ignore
 
 datasets_to_use
 
 force_running
 
 frontier_connection_name
 
 frontier_connection_overridden
 
 globaltag
 
 globaltag_check_cache
 
 harvesting_info
 
 harvesting_mode
 
 harvesting_mode_default
 
 harvesting_modes
 
 harvesting_type
 
 harvesting_types
 
 input_method
 
 input_name
 
 Jsonfilename
 
 Jsonlumi
 
 Jsonrunfilename
 
 log_level
 
 logger
 
 no_matching_site_found_str
 
 non_t1access
 
 nr_max_sites
 
 preferred_site
 
 ref_hist_mappings
 
 ref_hist_mappings_file_name
 
 ref_hist_mappings_file_name_default
 
 runs_to_ignore
 
 runs_to_use
 
 saveByLumiSection
 
 sites_and_versions_cache
 
 todofile
 
 use_ref_hists
 
 version
 

Detailed Description

CMSHarvester class.

Class to perform CMS harvesting.

More documentation `obviously' to follow.

Definition at line 296 of file cmsHarvester.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 305 of file cmsHarvester.py.

305  def __init__(self, cmd_line_opts=None):
306  "Initialize class and process command line options."
307 
308  self.version = __version__
309 
310  # These are the harvesting types allowed. See the head of this
311  # file for more information.
312  self.harvesting_types = [
313  "RelVal",
314  "RelValFS",
315  "MC",
316  "DQMOffline",
317  ]
318 
319  # These are the possible harvesting modes:
320  # - Single-step: harvesting takes place on-site in a single
321  # step. For each samples only a single ROOT file containing
322  # the harvesting results is returned.
323  # - Single-step-allow-partial: special hack to allow
324  # harvesting of partial statistics using single-step
325  # harvesting on spread-out samples.
326  # - Two-step: harvesting takes place in two steps. The first
327  # step returns a series of monitoring elenent summaries for
328  # each sample. The second step then merges these summaries
329  # locally and does the real harvesting. This second step
330  # produces the ROOT file containing the harvesting results.
331  self.harvesting_modes = [
332  "single-step",
333  "single-step-allow-partial",
334  "two-step"
335  ]
336 
337  # It is possible to specify a GlobalTag that will override any
338  # choices (regarding GlobalTags) made by the cmsHarvester.
339  # BUG BUG BUG
340  # For the moment, until I figure out a way to obtain the
341  # GlobalTag with which a given data (!) dataset was created,
342  # it is necessary to specify a GlobalTag for harvesting of
343  # data.
344  # BUG BUG BUG end
345  self.globaltag = None
346 
347  # It's also possible to switch off the use of reference
348  # histograms altogether.
349  self.use_ref_hists = True
350 
351  # The database name and account are hard-coded. They are not
352  # likely to change before the end-of-life of this tool. But of
353  # course there is a way to override this from the command
354  # line. One can even override the Frontier connection used for
355  # the GlobalTag and for the reference histograms
356  # independently. Please only use this for testing purposes.
357  self.frontier_connection_name = {}
358  self.frontier_connection_name["globaltag"] = "frontier://" \
359  "FrontierProd/"
360  self.frontier_connection_name["refhists"] = "frontier://" \
361  "FrontierProd/"
362  self.frontier_connection_overridden = {}
363  for key in self.frontier_connection_name.keys():
364  self.frontier_connection_overridden[key] = False
365 
366  # This contains information specific to each of the harvesting
367  # types. Used to create the harvesting configuration. It is
368  # filled by setup_harvesting_info().
369  self.harvesting_info = None
370 
371 
372 
373  # These are default `unused' values that will be filled in
374  # depending on the command line options.
375 
376  # The type of harvesting we're doing. See
377  # self.harvesting_types for allowed types.
378  self.harvesting_type = None
379 
380  # The harvesting mode, popularly known as single-step
381  # vs. two-step. The thing to remember at this point is that
382  # single-step is only possible for samples located completely
383  # at a single site (i.e. SE).
384  self.harvesting_mode = None
385  # BUG BUG BUG
386  # Default temporarily set to two-step until we can get staged
387  # jobs working with CRAB.
388  self.harvesting_mode_default = "single-step"
389  # BUG BUG BUG end
390 
391  # The input method: are we reading a dataset name (or regexp)
392  # directly from the command line or are we reading a file
393  # containing a list of dataset specifications. Actually we
394  # keep one of each for both datasets and runs.
395  self.input_method = {}
396  self.input_method["datasets"] = {}
397  self.input_method["datasets"]["use"] = None
398  self.input_method["datasets"]["ignore"] = None
399  self.input_method["runs"] = {}
400  self.input_method["runs"]["use"] = None
401  self.input_method["runs"]["ignore"] = None
402  self.input_method["runs"]["ignore"] = None
403  # The name of whatever input we're using.
404  self.input_name = {}
405  self.input_name["datasets"] = {}
406  self.input_name["datasets"]["use"] = None
407  self.input_name["datasets"]["ignore"] = None
408  self.input_name["runs"] = {}
409  self.input_name["runs"]["use"] = None
410  self.input_name["runs"]["ignore"] = None
411 
412  self.Jsonlumi = False
413  self.Jsonfilename = "YourJSON.txt"
414  self.Jsonrunfilename = "YourJSON.txt"
415  self.todofile = "YourToDofile.txt"
416 
417  # If this is true, we're running in `force mode'. In this case
418  # the sanity checks are performed but failure will not halt
419  # everything.
420  self.force_running = None
421 
422  # The base path of the output dir in CASTOR.
423  self.castor_base_dir = None
424  self.castor_base_dir_default = "/castor/cern.ch/" \
425  "cms/store/temp/" \
426  "dqm/offline/harvesting_output/"
427 
428  # The name of the file to be used for book keeping: which
429  # datasets, runs, etc. we have already processed.
430  self.book_keeping_file_name = None
431  self.book_keeping_file_name_default = "harvesting_accounting.txt"
432 
433  # The dataset name to reference histogram name mapping is read
434  # from a text file. The name of this file is kept in the
435  # following variable.
436  self.ref_hist_mappings_file_name = None
437  # And this is the default value.
438  self.ref_hist_mappings_file_name_default = "harvesting_ref_hist_mappings.txt"
439 
440  # Hmmm, hard-coded prefix of the CERN CASTOR area. This is the
441  # only supported CASTOR area.
442  # NOTE: Make sure this one starts with a `/'.
443  self.castor_prefix = "/castor/cern.ch"
444 
445  # Normally the central harvesting should be done using the
446  # `t1access' grid role. To be able to run without T1 access
447  # the --no-t1access flag can be used. This variable keeps
448  # track of that special mode.
449  self.non_t1access = False
450  self.caf_access = False
451  self.saveByLumiSection = False
452  self.crab_submission = False
453  self.nr_max_sites = 1
454 
455  self.preferred_site = "no preference"
456 
457  # This will become the list of datasets and runs to consider
458  self.datasets_to_use = {}
459  # and this will become the list of datasets and runs to skip.
460  self.datasets_to_ignore = {}
461  # This, in turn, will hold all book keeping information.
462  self.book_keeping_information = {}
463  # And this is where the dataset name to reference histogram
464  # name mapping is stored.
465  self.ref_hist_mappings = {}
466 
467  # We're now also allowing run selection. This means we also
468  # have to keep list of runs requested and vetoed by the user.
469  self.runs_to_use = {}
470  self.runs_to_ignore = {}
471 
472  # Cache for CMSSW version availability at different sites.
473  self.sites_and_versions_cache = {}
474 
475  # Cache for checked GlobalTags.
476  self.globaltag_check_cache = []
477 
478  # Global flag to see if there were any jobs for which we could
479  # not find a matching site.
480  self.all_sites_found = True
481 
482  # Helper string centrally defined.
483  self.no_matching_site_found_str = "no_matching_site_found"
484 
485  # Store command line options for later use.
486  if cmd_line_opts is None:
487  cmd_line_opts = sys.argv[1:]
488  self.cmd_line_opts = cmd_line_opts
489 
490  # Set up the logger.
491  log_handler = logging.StreamHandler()
492  # This is the default log formatter, the debug option switches
493  # on some more information.
494  log_formatter = logging.Formatter("%(message)s")
495  log_handler.setFormatter(log_formatter)
496  logger = logging.getLogger()
497  logger.name = "main"
498  logger.addHandler(log_handler)
499  self.logger = logger
500  # The default output mode is quite verbose.
501  self.set_output_level("NORMAL")
502 
503  #logger.debug("Initialized successfully")
504 
505  # End of __init__.
506 

Member Function Documentation

◆ cleanup()

def cmsHarvester.CMSHarvester.cleanup (   self)

Definition at line 509 of file cmsHarvester.py.

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

Referenced by esMonitoring.FDJsonServer.handle_close().

◆ config_file_header()

def cmsHarvester.CMSHarvester.config_file_header (   self)

Definition at line 603 of file cmsHarvester.py.

603  def config_file_header(self):
604  "Create a nice header to be used to mark the generated files."
605 
606  tmp = []
607 
608  time_stamp = self.time_stamp()
609  ident_str = self.ident_string()
610  tmp.append("# %s" % time_stamp)
611  tmp.append("# WARNING: This file was created automatically!")
612  tmp.append("")
613  tmp.append("# Created by %s" % ident_str)
614 
615  header = "\n".join(tmp)
616 
617  # End of config_file_header.
618  return header
619 

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

◆ db_account_name_cms_cond_dqm_summary()

def cmsHarvester.CMSHarvester.db_account_name_cms_cond_dqm_summary (   self)
See db_account_name_cms_cond_globaltag.

Definition at line 588 of file cmsHarvester.py.

588  def db_account_name_cms_cond_dqm_summary(self):
589  """See db_account_name_cms_cond_globaltag."""
590 
591  account_name = None
592  version = self.cmssw_version[6:11]
593  if version < "3_4_0":
594  account_name = "CMS_COND_31X_DQM_SUMMARY"
595  else:
596  account_name = "CMS_COND_34X"
597 
598  # End of db_account_name_cms_cond_dqm_summary.
599  return account_name
600 

◆ db_account_name_cms_cond_globaltag()

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

571  def db_account_name_cms_cond_globaltag(self):
572  """Return the database account name used to store the GlobalTag.
573 
574  The name of the database account depends (albeit weakly) on
575  the CMSSW release version.
576 
577  """
578 
579  # This never changed, unlike the cms_cond_31X_DQM_SUMMARY ->
580  # cms_cond_34X_DQM transition.
581  account_name = "CMS_COND_31X_GLOBALTAG"
582 
583  # End of db_account_name_cms_cond_globaltag.
584  return account_name
585 

◆ format_conditions_string()

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

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

References spr.find().

◆ ident_string()

def cmsHarvester.CMSHarvester.ident_string (   self)

Definition at line 534 of file cmsHarvester.py.

534  def ident_string(self):
535  "Spit out an identification string for cmsHarvester.py."
536 
537  ident_str = "`cmsHarvester.py " \
538  "version %s': cmsHarvester.py %s" % \
539  (__version__,
540  reduce(lambda x, y: x+' '+y, sys.argv[1:]))
541 
542  return ident_str
543 

Referenced by cmsHarvester.CMSHarvester.config_file_header().

◆ option_handler_book_keeping_file()

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

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

References cmsHarvester.CMSHarvester.book_keeping_file_name, info(), crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, conddb_version_mgr.conddb_tool.logger, o2olib.O2ORunMgr.logger, and cmsHarvester.CMSHarvester.logger.

◆ option_handler_debug()

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

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

References crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, conddb_version_mgr.conddb_tool.logger, o2olib.O2ORunMgr.logger, cmsHarvester.CMSHarvester.logger, and cmsHarvester.CMSHarvester.set_output_level().

◆ option_handler_force()

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

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

References debug, cmsHarvester.CMSHarvester.force_running, crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, conddb_version_mgr.conddb_tool.logger, o2olib.O2ORunMgr.logger, and cmsHarvester.CMSHarvester.logger.

◆ option_handler_frontier_connection()

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

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

References cmsHarvester.CMSHarvester.frontier_connection_name, cmsHarvester.CMSHarvester.frontier_connection_overridden, relativeConstraints.keys, crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, conddb_version_mgr.conddb_tool.logger, o2olib.O2ORunMgr.logger, cmsHarvester.CMSHarvester.logger, and MessageLogger_cfi.warning.

◆ option_handler_globaltag()

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

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

References alignment.Alignment.globaltag, cmsHarvester.CMSHarvester.globaltag, info(), crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, conddb_version_mgr.conddb_tool.logger, o2olib.O2ORunMgr.logger, and cmsHarvester.CMSHarvester.logger.

◆ option_handler_harvesting_mode()

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

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

References cmsHarvester.CMSHarvester.harvesting_mode, cmsHarvester.CMSHarvester.harvesting_modes, info(), join(), crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, conddb_version_mgr.conddb_tool.logger, o2olib.O2ORunMgr.logger, and cmsHarvester.CMSHarvester.logger.

◆ option_handler_harvesting_type()

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

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

References cmsHarvester.CMSHarvester.harvesting_type, cmsHarvester.CMSHarvester.harvesting_types, info(), join(), crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, conddb_version_mgr.conddb_tool.logger, o2olib.O2ORunMgr.logger, and cmsHarvester.CMSHarvester.logger.

◆ option_handler_input_Jsonfile()

def cmsHarvester.CMSHarvester.option_handler_input_Jsonfile (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 913 of file cmsHarvester.py.

913  def option_handler_input_Jsonfile(self, option, opt_str, value, parser):
914 
915  self.Jsonfilename = value
916  # End of option_handler_input_Jsonfile.
917 

References cmsHarvester.CMSHarvester.Jsonfilename.

◆ option_handler_input_Jsonrunfile()

def cmsHarvester.CMSHarvester.option_handler_input_Jsonrunfile (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 920 of file cmsHarvester.py.

920  def option_handler_input_Jsonrunfile(self, option, opt_str, value, parser):
921 
922  self.Jsonrunfilename = value
923  # End of option_handler_input_Jsonrunfile.
924 

References cmsHarvester.CMSHarvester.Jsonrunfilename.

◆ option_handler_input_spec()

def cmsHarvester.CMSHarvester.option_handler_input_spec (   self,
  option,
  opt_str,
  value,
  parser 
)
TODO TODO TODO
Document this...

Definition at line 927 of file cmsHarvester.py.

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

References debug, spr.find(), cmsHarvester.CMSHarvester.input_method, cmsHarvester.CMSHarvester.input_name, crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, conddb_version_mgr.conddb_tool.logger, o2olib.O2ORunMgr.logger, cmsHarvester.CMSHarvester.logger, and python.rootplot.root2matplotlib.replace().

◆ option_handler_input_todofile()

def cmsHarvester.CMSHarvester.option_handler_input_todofile (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 906 of file cmsHarvester.py.

906  def option_handler_input_todofile(self, option, opt_str, value, parser):
907 
908  self.todofile = value
909  # End of option_handler_input_todofile.
910 

References cmsHarvester.CMSHarvester.todofile.

◆ option_handler_no_ref_hists()

def cmsHarvester.CMSHarvester.option_handler_no_ref_hists (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 813 of file cmsHarvester.py.

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

References crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, conddb_version_mgr.conddb_tool.logger, o2olib.O2ORunMgr.logger, cmsHarvester.CMSHarvester.logger, cmsHarvester.CMSHarvester.use_ref_hists, and MessageLogger_cfi.warning.

◆ option_handler_quiet()

def cmsHarvester.CMSHarvester.option_handler_quiet (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 688 of file cmsHarvester.py.

688  def option_handler_quiet(self, option, opt_str, value, parser):
689  "Switch to quiet mode: less verbose."
690 
691  self.set_output_level("QUIET")
692 
693  # End of option_handler_quiet.
694 

References cmsHarvester.CMSHarvester.set_output_level().

◆ option_handler_ref_hist_mapping_file()

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

986  def option_handler_ref_hist_mapping_file(self, option, opt_str, value, parser):
987  """Store the name of the file for the ref. histogram mapping.
988 
989  """
990 
991  file_name = value
992 
993  if not self.ref_hist_mappings_file_name is None:
994  msg = "Only one reference histogram mapping file " \
995  "should be specified"
996  self.logger.fatal(msg)
997  raise Usage(msg)
998  self.ref_hist_mappings_file_name = file_name
999 
1000  self.logger.info("Reference histogram mapping file " \
1001  "to be used: `%s'" % \
1002  self.ref_hist_mappings_file_name)
1003 
1004  # End of option_handler_ref_hist_mapping_file.
1005 

References info(), crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, conddb_version_mgr.conddb_tool.logger, o2olib.O2ORunMgr.logger, cmsHarvester.CMSHarvester.logger, and cmsHarvester.CMSHarvester.ref_hist_mappings_file_name.

◆ set_output_level()

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

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

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

◆ time_stamp()

def cmsHarvester.CMSHarvester.time_stamp (   self)

Definition at line 521 of file cmsHarvester.py.

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

Referenced by cmsHarvester.CMSHarvester.config_file_header().

Member Data Documentation

◆ all_sites_found

cmsHarvester.CMSHarvester.all_sites_found

Definition at line 480 of file cmsHarvester.py.

◆ book_keeping_file_name

cmsHarvester.CMSHarvester.book_keeping_file_name

◆ book_keeping_file_name_default

cmsHarvester.CMSHarvester.book_keeping_file_name_default

Definition at line 431 of file cmsHarvester.py.

◆ book_keeping_information

cmsHarvester.CMSHarvester.book_keeping_information

Definition at line 462 of file cmsHarvester.py.

◆ caf_access

cmsHarvester.CMSHarvester.caf_access

Definition at line 450 of file cmsHarvester.py.

◆ castor_base_dir

cmsHarvester.CMSHarvester.castor_base_dir

Definition at line 423 of file cmsHarvester.py.

◆ castor_base_dir_default

cmsHarvester.CMSHarvester.castor_base_dir_default

Definition at line 424 of file cmsHarvester.py.

◆ castor_prefix

cmsHarvester.CMSHarvester.castor_prefix

Definition at line 443 of file cmsHarvester.py.

◆ cmd_line_opts

cmsHarvester.CMSHarvester.cmd_line_opts

Definition at line 488 of file cmsHarvester.py.

◆ crab_submission

cmsHarvester.CMSHarvester.crab_submission

Definition at line 452 of file cmsHarvester.py.

◆ datasets_to_ignore

cmsHarvester.CMSHarvester.datasets_to_ignore

Definition at line 460 of file cmsHarvester.py.

◆ datasets_to_use

cmsHarvester.CMSHarvester.datasets_to_use

Definition at line 458 of file cmsHarvester.py.

◆ force_running

cmsHarvester.CMSHarvester.force_running

Definition at line 420 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_force().

◆ frontier_connection_name

cmsHarvester.CMSHarvester.frontier_connection_name

◆ frontier_connection_overridden

cmsHarvester.CMSHarvester.frontier_connection_overridden

◆ globaltag

cmsHarvester.CMSHarvester.globaltag

Definition at line 345 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_globaltag().

◆ globaltag_check_cache

cmsHarvester.CMSHarvester.globaltag_check_cache

Definition at line 476 of file cmsHarvester.py.

◆ harvesting_info

cmsHarvester.CMSHarvester.harvesting_info

Definition at line 369 of file cmsHarvester.py.

◆ harvesting_mode

cmsHarvester.CMSHarvester.harvesting_mode

◆ harvesting_mode_default

cmsHarvester.CMSHarvester.harvesting_mode_default

Definition at line 388 of file cmsHarvester.py.

◆ harvesting_modes

cmsHarvester.CMSHarvester.harvesting_modes

◆ harvesting_type

cmsHarvester.CMSHarvester.harvesting_type

◆ harvesting_types

cmsHarvester.CMSHarvester.harvesting_types

◆ input_method

cmsHarvester.CMSHarvester.input_method

◆ input_name

cmsHarvester.CMSHarvester.input_name

◆ Jsonfilename

cmsHarvester.CMSHarvester.Jsonfilename

◆ Jsonlumi

cmsHarvester.CMSHarvester.Jsonlumi

Definition at line 412 of file cmsHarvester.py.

◆ Jsonrunfilename

cmsHarvester.CMSHarvester.Jsonrunfilename

◆ log_level

cmsHarvester.CMSHarvester.log_level

Definition at line 649 of file cmsHarvester.py.

◆ logger

cmsHarvester.CMSHarvester.logger

◆ no_matching_site_found_str

cmsHarvester.CMSHarvester.no_matching_site_found_str

Definition at line 483 of file cmsHarvester.py.

◆ non_t1access

cmsHarvester.CMSHarvester.non_t1access

Definition at line 449 of file cmsHarvester.py.

◆ nr_max_sites

cmsHarvester.CMSHarvester.nr_max_sites

Definition at line 453 of file cmsHarvester.py.

◆ preferred_site

cmsHarvester.CMSHarvester.preferred_site

Definition at line 455 of file cmsHarvester.py.

◆ ref_hist_mappings

cmsHarvester.CMSHarvester.ref_hist_mappings

Definition at line 465 of file cmsHarvester.py.

◆ ref_hist_mappings_file_name

cmsHarvester.CMSHarvester.ref_hist_mappings_file_name

◆ ref_hist_mappings_file_name_default

cmsHarvester.CMSHarvester.ref_hist_mappings_file_name_default

Definition at line 438 of file cmsHarvester.py.

◆ runs_to_ignore

cmsHarvester.CMSHarvester.runs_to_ignore

Definition at line 470 of file cmsHarvester.py.

◆ runs_to_use

cmsHarvester.CMSHarvester.runs_to_use

Definition at line 469 of file cmsHarvester.py.

◆ saveByLumiSection

cmsHarvester.CMSHarvester.saveByLumiSection

Definition at line 451 of file cmsHarvester.py.

◆ sites_and_versions_cache

cmsHarvester.CMSHarvester.sites_and_versions_cache

Definition at line 473 of file cmsHarvester.py.

◆ todofile

cmsHarvester.CMSHarvester.todofile

◆ use_ref_hists

cmsHarvester.CMSHarvester.use_ref_hists

◆ version

cmsHarvester.CMSHarvester.version
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
MessageLogger_cfi.warning
warning
Definition: MessageLogger_cfi.py:18
debug
#define debug
Definition: HDRShower.cc:19
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444
edm::cleanup
static void cleanup(const Factory::MakerMap::value_type &v)
Definition: Factory.cc:12