def test5LoadKeyStoreFromPoolFile(self): """Test loading a CfgKeyStore from a POOL file""" from AthenaCommon.KeyStore import loadKeyStoreFromPoolFile ## FIXME ## Can't run that test as the content of that file lives in AtlasEvent ## --> skip it for now return import os pool_file = os.sep.join([ "/afs/cern.ch/atlas/offline/test", "atlfast.aod.herwig_rel13.pool" ]) ks = loadKeyStoreFromPoolFile(keyStore='test_loadFromPoolFile', pool_file=pool_file, label='inputFile') pool_file_content = [ 'Analysis::MuonContainer#AtlfastMuonCollection', 'Analysis::MuonContainer#AtlfastNonIsoMuonCollection', 'Analysis::TauJetContainer#AtlfastTauJet1p3pContainer', 'Analysis::TauJetContainer#AtlfastTauJetContainer', 'DataHeader#OutStream', 'ElectronContainer#AtlfastElectronCollection', 'EventInfo#McEventInfo', 'INav4MomAssocs#AtlfastMcAodAssocs', 'INav4MomAssocs#DeltaRAssocs', 'McEventCollection#GEN_AOD', 'MissingET#AtlfastMissingEt', 'ParticleJetContainer#AtlfastParticleJetContainer', 'PhotonContainer#AtlfastPhotonCollection', 'TruthParticleContainer#SpclMC' ] self.failUnless(sorted(ks.inputFile()) == sorted(pool_file_content)) self.failUnless(len(ks.inputFile.dict().keys()) == 11) del ks return
def test5LoadKeyStoreFromPoolFile( self ): """Test loading a CfgKeyStore from a POOL file""" from AthenaCommon.KeyStore import loadKeyStoreFromPoolFile ## FIXME ## Can't run that test as the content of that file lives in AtlasEvent ## --> skip it for now return import os pool_file = os.sep.join(["/afs/cern.ch/atlas/offline/test", "atlfast.aod.herwig_rel13.pool"]) ks = loadKeyStoreFromPoolFile(keyStore='test_loadFromPoolFile', pool_file=pool_file, label='inputFile') pool_file_content = [ 'Analysis::MuonContainer#AtlfastMuonCollection', 'Analysis::MuonContainer#AtlfastNonIsoMuonCollection', 'Analysis::TauJetContainer#AtlfastTauJet1p3pContainer', 'Analysis::TauJetContainer#AtlfastTauJetContainer', 'DataHeader#OutStream', 'ElectronContainer#AtlfastElectronCollection', 'EventInfo#McEventInfo', 'INav4MomAssocs#AtlfastMcAodAssocs', 'INav4MomAssocs#DeltaRAssocs', 'McEventCollection#GEN_AOD', 'MissingET#AtlfastMissingEt', 'ParticleJetContainer#AtlfastParticleJetContainer', 'PhotonContainer#AtlfastPhotonCollection', 'TruthParticleContainer#SpclMC'] self.failUnless(sorted(ks.inputFile()) == sorted(pool_file_content)) self.failUnless(len(ks.inputFile.dict().keys()) == 11) del ks return
if options.fileName == None and len(fileNames) == 0: str(parser.print_help() or "") sys.exit(1) if not (options.fileName is None): fileName = os.path.expandvars(os.path.expanduser(options.fileName)) fileNames.append(fileName) fileNames = set(fileNames) sc = 0 for fileName in fileNames: try: from AthenaCommon.KeyStore import loadKeyStoreFromPoolFile print "## checking [%s]..." % fileName ks = loadKeyStoreFromPoolFile(keyStore=os.path.basename(fileName), pool_file=fileName, label='inputFile') print "=" * 80 print "%40s%s%-40s" % ("Container type", " | ", "StoreGate keys") print "%40s%s%-40s" % ("-" * 40, "-+-", "-" * (40 - 3)) for name, sgkeys in ks.inputFile.dict().items(): print "%40s%s%-40s" % (name, " | ", ', '.join(sgkeys)) print "=" * 80 if options.outFileName: osp = os.path outFileName = options.outFileName outFileName = osp.expanduser(outFileName) outFileName = osp.expandvars(outFileName) print "## saving checkSG report into [%s]..." % outFileName if os.path.splitext(outFileName)[1] in ('.pkl', '.dat'): # we explicitely import 'bsddb' to try to always
if options.fileName == None and len(fileNames) == 0: str(parser.print_help() or "") sys.exit(1) if not (options.fileName is None): fileName = os.path.expandvars(os.path.expanduser(options.fileName)) fileNames.append(fileName) fileNames = set( fileNames ) sc = 0 for fileName in fileNames: try: from AthenaCommon.KeyStore import loadKeyStoreFromPoolFile print "## checking [%s]..."%fileName ks = loadKeyStoreFromPoolFile(keyStore=os.path.basename(fileName), pool_file=fileName, label='inputFile') print "="*80 print "%40s%s%-40s" % ("Container type", " | ","StoreGate keys") print "%40s%s%-40s" % ("-"*40, "-+-", "-"*(40-3)) for name,sgkeys in ks.inputFile.dict().items(): print "%40s%s%-40s" % (name, " | ", ', '.join(sgkeys)) print "="*80 if options.outFileName: osp = os.path outFileName = options.outFileName outFileName = osp.expanduser(outFileName) outFileName = osp.expandvars(outFileName) print "## saving checkSG report into [%s]..." % outFileName if os.path.splitext(outFileName)[1] in ('.pkl', '.dat'): # we explicitely import 'bsddb' to try to always