CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
dataset.BaseDataset Class Reference
Inheritance diagram for dataset.BaseDataset:
dataset.CMSDataset dataset.Dataset dataset.EOSDataset dataset.LocalDataset dataset.PrivateDataset

Public Member Functions

def __init__ (self, name, user, pattern='.*root', run_range=None, dbsInstance=None)
 def init(self, name, user, pattern='. More...
 
def buildListOfBadFiles (self)
 
def buildListOfFiles (self, pattern)
 
def extractFileSizes (self)
 
def getPrimaryDatasetEntries (self)
 
def listOfFiles (self)
 
def listOfGoodFiles (self)
 
def listOfGoodFilesWithPrescale (self, prescale)
 
def printFiles (self, abspath=True, info=True)
 
def printInfo (self)
 

Public Attributes

 bad_files
 
 dbsInstance
 MM. More...
 
 files
 
 filesAndSizes
 
 good_files
 
 name
 
 pattern
 
 primaryDatasetEntries
 MM. More...
 
 report
 
 run_range
 
 user
 

Detailed Description

Definition at line 19 of file dataset.py.

Constructor & Destructor Documentation

def dataset.BaseDataset.__init__ (   self,
  name,
  user,
  pattern = '.*root',
  run_range = None,
  dbsInstance = None 
)

def init(self, name, user, pattern='.

*root', run_range=None):

Definition at line 22 of file dataset.py.

22  def __init__(self, name, user, pattern='.*root', run_range=None, dbsInstance=None):
23  self.name = name
24  self.user = user
25  self.pattern = pattern
26  self.run_range = run_range
27  ### MM
28  self.dbsInstance = dbsInstance
29  ### MM
31  self.report = None
32  self.buildListOfFiles( self.pattern )
33  self.extractFileSizes()
34  self.buildListOfBadFiles()
36 
def __init__(self, name, user, pattern='.*root', run_range=None, dbsInstance=None)
def init(self, name, user, pattern='.
Definition: dataset.py:22
def buildListOfFiles(self, pattern)
Definition: dataset.py:37
def getPrimaryDatasetEntries(self)
Definition: dataset.py:53
def extractFileSizes(self)
Definition: dataset.py:40
primaryDatasetEntries
MM.
Definition: dataset.py:30
def buildListOfBadFiles(self)
Definition: dataset.py:45

Member Function Documentation

def dataset.BaseDataset.buildListOfBadFiles (   self)

Definition at line 45 of file dataset.py.

46  self.good_files = []
47  self.bad_files = {}
48 
def buildListOfBadFiles(self)
Definition: dataset.py:45
def dataset.BaseDataset.buildListOfFiles (   self,
  pattern 
)

Definition at line 37 of file dataset.py.

Referenced by dataset.BaseDataset.printFiles().

37  def buildListOfFiles( self, pattern ):
38  self.files = []
39 
def buildListOfFiles(self, pattern)
Definition: dataset.py:37
def dataset.BaseDataset.extractFileSizes (   self)
Get the file size for each file, 
from the eos ls -l command.

Definition at line 40 of file dataset.py.

40  def extractFileSizes(self):
41  '''Get the file size for each file,
42  from the eos ls -l command.'''
43  self.filesAndSizes = {}
44 
def extractFileSizes(self)
Definition: dataset.py:40
def dataset.BaseDataset.getPrimaryDatasetEntries (   self)

Definition at line 53 of file dataset.py.

References dataset.BaseDataset.primaryDatasetEntries.

54  return self.primaryDatasetEntries
55 
def getPrimaryDatasetEntries(self)
Definition: dataset.py:53
primaryDatasetEntries
MM.
Definition: dataset.py:30
def dataset.BaseDataset.listOfFiles (   self)
Returns all files, even the bad ones.

Definition at line 79 of file dataset.py.

References readConfig.fileINI.files, dataset.BaseDataset.files, chain.Chain.files, MatrixReader.MatrixReader.files, MatrixUtil.InputInfo.files, and JsonOutputProducer::JsonConfigurationBlock.files.

79  def listOfFiles(self):
80  '''Returns all files, even the bad ones.'''
81  return self.files
82 
def listOfFiles(self)
Definition: dataset.py:79
def dataset.BaseDataset.listOfGoodFiles (   self)
Returns all files flagged as good in the integrity 
check text output, or not present in this file, are 
considered as good.

Definition at line 83 of file dataset.py.

References dataset.BaseDataset.bad_files, readConfig.fileINI.files, dataset.BaseDataset.files, chain.Chain.files, MatrixReader.MatrixReader.files, MatrixUtil.InputInfo.files, JsonOutputProducer::JsonConfigurationBlock.files, and dataset.BaseDataset.good_files.

Referenced by dataset.BaseDataset.listOfGoodFilesWithPrescale().

83  def listOfGoodFiles(self):
84  '''Returns all files flagged as good in the integrity
85  check text output, or not present in this file, are
86  considered as good.'''
87  self.good_files = []
88  for file in self.files:
89  if file not in self.bad_files:
90  self.good_files.append( file )
91  return self.good_files
92 
def listOfGoodFiles(self)
Definition: dataset.py:83
def dataset.BaseDataset.listOfGoodFilesWithPrescale (   self,
  prescale 
)
Takes the list of good files and selects a random sample 
from them according to the prescale factor. 
E.g. a prescale of 10 will select 1 in 10 files.

Definition at line 93 of file dataset.py.

References dataset.BaseDataset.good_files, dataset.int, and dataset.BaseDataset.listOfGoodFiles().

93  def listOfGoodFilesWithPrescale(self, prescale):
94  """Takes the list of good files and selects a random sample
95  from them according to the prescale factor.
96  E.g. a prescale of 10 will select 1 in 10 files."""
97 
98  good_files = self.listOfGoodFiles()
99  if prescale < 2:
100  return self.good_files
101 
102  #the number of files to select from the dataset
103  num_files = int( (len(good_files)/(1.0*prescale)) + 0.5)
104  if num_files < 1:
105  num_files = 1
106  if num_files > len(good_files):
107  num_files = len(good_files)
108 
109  #pick unique good files randomly
110  import random
111  subset = set()
112  while len(subset) < num_files:
113  #pick a random file from the list
114  choice = random.choice(good_files)
115  slen = len(subset)
116  #add to the set
117  subset.add(choice)
118  #if this was a unique file remove so we don't get
119  #very slow corner cases where prescale is small
120  if len(subset) > slen:
121  good_files.remove(choice)
122  assert len(subset)==num_files,'The number of files does not match'
123 
124  return [f for f in subset]
125 
def listOfGoodFiles(self)
Definition: dataset.py:83
def listOfGoodFilesWithPrescale(self, prescale)
Definition: dataset.py:93
def dataset.BaseDataset.printFiles (   self,
  abspath = True,
  info = True 
)

Definition at line 56 of file dataset.py.

References dataset.BaseDataset.bad_files, dataset.BaseDataset.buildListOfFiles(), readConfig.fileINI.files, dataset.BaseDataset.files, chain.Chain.files, MatrixReader.MatrixReader.files, MatrixUtil.InputInfo.files, JsonOutputProducer::JsonConfigurationBlock.files, dataset.BaseDataset.good_files, dataset.BaseDataset.pattern, CSCALCT.pattern, presentation.PageLayout.pattern, l1t::EMTFRoad.pattern, L1TMuon::TriggerPrimitive::CSCData.pattern, CSCCathodeLCTProcessor.pattern, CSCCorrelatedLCTDigi.pattern, cscdqm::MOFilterItem.pattern, l1t::EMTFHit.pattern, and dataset.BaseDataset.primaryDatasetEntries.

56  def printFiles(self, abspath=True, info=True):
57  # import pdb; pdb.set_trace()
58  if self.files == None:
59  self.buildListOfFiles(self.pattern)
60  for file in self.files:
61  status = 'OK'
62  if file in self.bad_files:
63  status = self.bad_files[file]
64  elif file not in self.good_files:
65  status = 'UNKNOWN'
66  fileNameToPrint = file
67  if abspath == False:
68  fileNameToPrint = os.path.basename(file)
69  if info:
70  size=self.filesAndSizes.get(file,'UNKNOWN').rjust(10)
71  # if size is not None:
72  # size = size.rjust(10)
73  print status.ljust(10), size, \
74  '\t', fileNameToPrint
75  else:
76  print fileNameToPrint
77  print 'PrimaryDatasetEntries: %d' % self.primaryDatasetEntries
78 
def buildListOfFiles(self, pattern)
Definition: dataset.py:37
primaryDatasetEntries
MM.
Definition: dataset.py:30
def printFiles(self, abspath=True, info=True)
Definition: dataset.py:56
def dataset.BaseDataset.printInfo (   self)

Definition at line 49 of file dataset.py.

References ElectronMVAID.ElectronMVAID.name, counter.Counter.name, average.Average.name, AlignableObjectId::entry.name, histograms.Histograms.name, TmModule.name, cond::persistency::TAG::NAME.name, cond::persistency::GLOBAL_TAG::NAME.name, core.autovars.NTupleVariable.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, cond::persistency::TAG::TIME_TYPE.name, cond::persistency::GLOBAL_TAG::VALIDITY.name, cond::persistency::RUN_INFO::START_TIME.name, cond::persistency::TAG::OBJECT_TYPE.name, cond::persistency::GLOBAL_TAG::DESCRIPTION.name, cond::persistency::RUN_INFO::END_TIME.name, cond::persistency::TAG::SYNCHRONIZATION.name, cond::persistency::GLOBAL_TAG::RELEASE.name, cond::persistency::TAG::END_OF_VALIDITY.name, MEPSet.name, cond::persistency::GLOBAL_TAG::SNAPSHOT_TIME.name, cond::persistency::TAG::DESCRIPTION.name, cond::persistency::GTEditorData.name, cond::persistency::GLOBAL_TAG::INSERTION_TIME.name, nanoaod::MergeableCounterTable::SingleColumn< T >.name, cond::persistency::TAG::LAST_VALIDATED_TIME.name, FWTGeoRecoGeometry::Info.name, Types._Untracked.name, preexistingValidation.PreexistingValidation.name, cond::persistency::TAG::INSERTION_TIME.name, cond::persistency::TAG::MODIFICATION_TIME.name, dataset.BaseDataset.name, OutputMEPSet.name, personalPlayback.Applet.name, ParameterSet.name, PixelDCSObject< T >::Item.name, analyzer.Analyzer.name, DQMRivetClient::LumiOption.name, MagCylinder.name, ParSet.name, DQMRivetClient::ScaleFactorOption.name, SingleObjectCondition.name, EgHLTOfflineSummaryClient::SumHistBinData.name, cond::persistency::GTProxyData.name, core.autovars.NTupleObjectType.name, Mapper::definition< ScannerT >.name, MyWatcher.name, edm::PathTimingSummary.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, alignment.Alignment.name, cond::TimeTypeSpecs.name, lumi::TriggerInfo.name, edm::PathSummary.name, PixelEndcapLinkMaker::Item.name, DQMGenericClient::EfficOption.name, perftools::EdmEventSize::BranchRecord.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, FWTableViewManager::TableEntry.name, PixelBarrelLinkMaker::Item.name, validateAlignments.ParallelMergeJob.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, EcalLogicID.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, MEtoEDM< T >::MEtoEDMObject.name, ExpressionHisto< T >.name, XMLProcessor::_loaderBaseConfig.name, cond::persistency::PAYLOAD::HASH.name, TreeCrawler.Package.name, genericValidation.GenericValidation.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, cond::persistency::PAYLOAD::DATA.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, cond::persistency::PAYLOAD::VERSION.name, MagGeoBuilderFromDDD::volumeHandle.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, DQMGenericClient::ProfileOption.name, options.ConnectionHLTMenu.name, DQMGenericClient::NormOption.name, FastHFShowerLibrary.name, emtf::Node.name, h4DSegm.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, PhysicsTools::Calibration::Variable.name, DQMGenericClient::CDOption.name, CounterChecker.name, EDMtoMEConverter.name, cond::TagInfo_t.name, looper.Looper.name, cond::persistency::IOV::TAG_NAME.name, TrackerSectorStruct.name, cond::persistency::IOV::SINCE.name, cond::persistency::IOV::PAYLOAD_HASH.name, classes.MonitorData.name, cond::persistency::IOV::INSERTION_TIME.name, HistogramManager.name, MuonGeometrySanityCheckPoint.name, classes.OutputData.name, options.HLTProcessOptions.name, h2DSegm.name, core.TriggerBitAnalyzer.TriggerBitAnalyzer.name, nanoaod::FlatTable::Column.name, config.Analyzer.name, geometry.Structure.name, core.autovars.NTupleSubObject.name, DQMNet::WaitObject.name, AlpgenParameterName.name, SiStripMonitorDigi.name, core.autovars.NTupleObject.name, config.Service.name, cond::persistency::TAG_LOG::TAG_NAME.name, cond::persistency::TAG_LOG::EVENT_TIME.name, cond::persistency::TAG_LOG::USER_NAME.name, cond::persistency::TAG_LOG::HOST_NAME.name, cond::persistency::TAG_LOG::COMMAND.name, cond::persistency::TAG_LOG::ACTION.name, cond::persistency::TAG_LOG::USER_TEXT.name, core.autovars.NTupleCollection.name, BPHRecoBuilder::BPHRecoSource.name, BPHRecoBuilder::BPHCompSource.name, personalPlayback.FrameworkJob.name, plotscripts.SawTeethFunction.name, hTMaxCell.name, cscdqm::ParHistoDef.name, BeautifulSoup.Tag.name, SummaryOutputProducer::GenericSummary.name, BeautifulSoup.SoupStrainer.name, dataset.BaseDataset.user, EcalTPGParamReaderFromDB.user, popcon::RpcObGasData.user, popcon::RPCObPVSSmapData.user, popcon::RpcDataT.user, popcon::RpcDataV.user, popcon::RpcDataFebmap.user, popcon::RpcDataUXC.user, popcon::RpcDataI.user, popcon::RpcDataGasMix.user, popcon::RpcDataS.user, MatrixInjector.MatrixInjector.user, and EcalDBConnection.user.

49  def printInfo(self):
50  print 'sample : ' + self.name
51  print 'user : ' + self.user
52 
def printInfo(self)
Definition: dataset.py:49

Member Data Documentation

dataset.BaseDataset.bad_files
dataset.BaseDataset.dbsInstance

MM.

Definition at line 28 of file dataset.py.

Referenced by dataset.PrivateDataset.getPrimaryDatasetEntries().

dataset.BaseDataset.files
dataset.BaseDataset.filesAndSizes

Definition at line 43 of file dataset.py.

dataset.BaseDataset.good_files
dataset.BaseDataset.name
dataset.BaseDataset.pattern

Definition at line 25 of file dataset.py.

Referenced by dataset.BaseDataset.printFiles().

dataset.BaseDataset.primaryDatasetEntries
dataset.BaseDataset.report

Definition at line 31 of file dataset.py.

Referenced by dataset.Dataset.getPrimaryDatasetEntries(), and addOnTests.testit.run().

dataset.BaseDataset.run_range
dataset.BaseDataset.user