CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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__
 
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

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

Constructor & Destructor Documentation

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

Definition at line 304 of file cmsHarvester.py.

305  def __init__(self, cmd_line_opts=None):
306  "Initialize class and process command line options."
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/"
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
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.
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
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__.

Member Function Documentation

def cmsHarvester.CMSHarvester.cleanup (   self)

Definition at line 508 of file cmsHarvester.py.

Referenced by esMonitoring.FDJsonServer.handle_close().

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.
def cmsHarvester.CMSHarvester.config_file_header (   self)

Definition at line 602 of file cmsHarvester.py.

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

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
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
def cmsHarvester.CMSHarvester.db_account_name_cms_cond_dqm_summary (   self)
See db_account_name_cms_cond_globaltag.

Definition at line 587 of file cmsHarvester.py.

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

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

References spr.find().

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
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
def cmsHarvester.CMSHarvester.ident_string (   self)

Definition at line 533 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.config_file_header().

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

References cmsHarvester.CMSHarvester.book_keeping_file_name.

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'" % \
981 
982  # 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 660 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.set_output_level().

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

References cmsHarvester.CMSHarvester.force_running.

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.
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.

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

Referenced by cmsHarvester.CMSHarvester.option_handler_no_ref_hists().

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

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

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

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

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.
Helper class: Usage exception.
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
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 712 of file cmsHarvester.py.

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

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.
Helper class: Usage exception.
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
def cmsHarvester.CMSHarvester.option_handler_input_Jsonfile (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 912 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.Jsonfilename.

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

Definition at line 919 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.Jsonrunfilename.

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

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

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
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Helper class: Usage exception.
def cmsHarvester.CMSHarvester.option_handler_input_todofile (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 905 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.todofile.

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

Definition at line 812 of file cmsHarvester.py.

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

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  ##########
def cmsHarvester.CMSHarvester.option_handler_quiet (   self,
  option,
  opt_str,
  value,
  parser 
)

Definition at line 687 of file cmsHarvester.py.

References cmsHarvester.CMSHarvester.set_output_level().

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

References cmsHarvester.CMSHarvester.ref_hist_mappings_file_name.

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'" % \
1003 
1004  # 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 621 of file cmsHarvester.py.

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

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.
def cmsHarvester.CMSHarvester.time_stamp (   self)

Definition at line 520 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.config_file_header().

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

Member Data Documentation

cmsHarvester.CMSHarvester.all_sites_found

Definition at line 479 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.book_keeping_file_name

Definition at line 429 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_book_keeping_file().

cmsHarvester.CMSHarvester.book_keeping_file_name_default

Definition at line 430 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.book_keeping_information

Definition at line 461 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.caf_access

Definition at line 449 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.castor_base_dir

Definition at line 422 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.castor_base_dir_default

Definition at line 423 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.castor_prefix

Definition at line 442 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.cmd_line_opts

Definition at line 487 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.crab_submission

Definition at line 451 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.datasets_to_ignore

Definition at line 459 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.datasets_to_use

Definition at line 457 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.force_running

Definition at line 419 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_force().

cmsHarvester.CMSHarvester.frontier_connection_name

Definition at line 356 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_frontier_connection().

cmsHarvester.CMSHarvester.frontier_connection_overridden

Definition at line 361 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_frontier_connection().

cmsHarvester.CMSHarvester.globaltag

Definition at line 344 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_globaltag().

cmsHarvester.CMSHarvester.globaltag_check_cache

Definition at line 475 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.harvesting_info

Definition at line 368 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.harvesting_mode

Definition at line 383 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_mode().

cmsHarvester.CMSHarvester.harvesting_mode_default

Definition at line 387 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.harvesting_modes

Definition at line 330 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_mode().

cmsHarvester.CMSHarvester.harvesting_type

Definition at line 377 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_type().

cmsHarvester.CMSHarvester.harvesting_types

Definition at line 311 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_harvesting_type().

cmsHarvester.CMSHarvester.input_method

Definition at line 394 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_input_spec().

cmsHarvester.CMSHarvester.input_name

Definition at line 403 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_input_spec().

cmsHarvester.CMSHarvester.Jsonfilename

Definition at line 412 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_input_Jsonfile().

cmsHarvester.CMSHarvester.Jsonlumi

Definition at line 411 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.Jsonrunfilename

Definition at line 413 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_input_Jsonrunfile().

cmsHarvester.CMSHarvester.log_level

Definition at line 648 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.logger

Definition at line 498 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.no_matching_site_found_str

Definition at line 482 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.non_t1access

Definition at line 448 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.nr_max_sites

Definition at line 452 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.preferred_site

Definition at line 454 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.ref_hist_mappings

Definition at line 464 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.ref_hist_mappings_file_name

Definition at line 435 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_ref_hist_mapping_file().

cmsHarvester.CMSHarvester.ref_hist_mappings_file_name_default

Definition at line 437 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.runs_to_ignore

Definition at line 469 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.runs_to_use

Definition at line 468 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.saveByLumiSection

Definition at line 450 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.sites_and_versions_cache

Definition at line 472 of file cmsHarvester.py.

cmsHarvester.CMSHarvester.todofile

Definition at line 414 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_input_todofile().

cmsHarvester.CMSHarvester.use_ref_hists

Definition at line 348 of file cmsHarvester.py.

Referenced by cmsHarvester.CMSHarvester.option_handler_no_ref_hists().

cmsHarvester.CMSHarvester.version

Definition at line 307 of file cmsHarvester.py.

Referenced by validation.Sample.datasetpattern(), and validation.Sample.filename().