CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
createPayload Namespace Reference

Functions

def copyToWorkflowdir
 
def mkWorkflowdir
 

Variables

string allbeam_file = workflowdirArchive+"AllIOVs/"
 
tuple allfile = open( allbeam_file, 'a')
 
tuple alllines = mergedfile.readlines()
 
tuple alumi = line.split()
 
string alumis = ''
 
string arun = ''
 
tuple atime = line.split()
 
list beam_file = sortedlist[key]
 WRITE sqlite file. More...
 
list beam_file_tmp = workflowdirTmp+beam_file[beam_file.rfind('/')+1:]
 
list block = alllines[i * 23: (i+1)*23]
 
 checkType = tagType
 
string destDB = 'oracle://cms_orcon_prod/CMS_COND_31X_BEAMSPOT'
 
tuple dfile = open(metadata_file,'w')
 
string dropbox = "/DropBox"
 
string final_sqlite_file_name = tagname+'@'
 
string iov_comment = 'Beam spot position'
 
string iov_since = '1'
 
string iov_since_first = '1'
 
string iov_till = ''
 
string IOVbase = 'runbase'
 
tuple keys = sorted(sortedlist.keys())
 
list line = block[0]
 
tuple listoffiles = copyToWorkflowdir(option.data)
 
tuple mergedfile = open(beam_file)
 
string metadata_file = workflowdirTmp+sqlite_file_name+'.txt'
 
tuple newtmpfile = open(beam_file_tmp,"w")
 
int nfile = 0
 
tuple npayloads = len(alllines)
 
string optionstring = ''
 
tuple readdb_template = os.getenv("CMSSW_BASE")
 
 skip = False
 
dictionary sortedlist = {}
 
string sqlite_file = workflowdirTmp+sqlite_file_name+'.db'
 READ and check sqlite file. More...
 
 sqlite_file_name = tagname+suffix
 
string suffix = "_"
 
string tagname = ''
 
string tagType = ''
 
string timetype = 'runnumber'
 
string tmp_datafilename = workflowdirTmp+"tmp_datafile.txt"
 
string tmp_lumi_since = ""
 
string tmp_lumi_till = ""
 
string tmp_run = ""
 
tuple tmpfile = open(beam_file)
 
tuple total_files = len(keys)
 
tuple uuid = subprocess.getstatusoutput('uuidgen -t')
 
string workflowdir = 'test/workflow/'
 3 More...
 
string workflowdirArchive = workflowdir+'archive/'
 
string workflowdirLastPayloads = workflowdir+'lastPayloads/'
 
string workflowdirTmp = workflowdir+'tmp/'
 
tuple writedb_template = os.getenv("CMSSW_BASE")
 

Function Documentation

def createPayload.copyToWorkflowdir (   path)

Definition at line 53 of file createPayload.py.

References beamvalidation.exit(), spr.find(), print(), sistrip::SpyUtilities.range(), submitPVValidationJobs.split(), and str.

Referenced by mkWorkflowdir().

53 
54 def copyToWorkflowdir(path):
55  global workflowdirArchive
56  lsCommand = ''
57  cpCommand = ''
58  listoffiles = []
59  tmplistoffiles = []
60  if path.find('castor') != -1:
61  print("Getting files from castor ...")
62  lsCommand = 'ns'
63  cpCommand = 'rf'
64  elif not os.path.exists(path):
65  exit("ERROR: File or directory " + path + " doesn't exist")
66 
67  if path[len(path)-4:len(path)] != '.txt':
68  if path[len(path)-1] != '/':
69  path = path + '/'
70 
71  aCommand = lsCommand + 'ls '+ path + " | grep .txt"
72 
73  tmpstatus = subprocess.getstatusoutput( aCommand )
74  tmplistoffiles = tmpstatus[1].split('\n')
75  if len(tmplistoffiles) == 1:
76  if tmplistoffiles[0] == '':
77  exit('ERROR: No files found in directory ' + path)
78  if tmplistoffiles[0].find('No such file or directory') != -1:
79  exit("ERROR: File or directory " + path + " doesn't exist")
80 
81  else:
82  tmplistoffiles.append(path[path.rfind('/')+1:len(path)])
83  path = path[0:path.rfind('/')+1]
84 
85 
86  archiveName = path
87  if path == './':
88  archiveName = os.getcwd() + '/'
89  archiveName = archiveName[archiveName[:len(archiveName)-1].rfind('/')+1:len(archiveName)]
90  if path[:len(path)-1].rfind('/') != -1:
91  archiveName = path[path[:len(path)-1].rfind('/')+1:len(path)]
92 
93  workflowdirArchive = workflowdirArchive + archiveName
94  if tagType != '' :
95  workflowdirArchive = workflowdirArchive[:len(workflowdirArchive)-1] + '_' + tagType + '/'
96  if not os.path.isdir(workflowdirArchive):
97  os.mkdir(workflowdirArchive)
98  elif(option.newarchive):
99 # tmpTime = str(datetime.datetime.now())
100 # tmpTime = tmpTime.replace(' ','-')
101 # tmpTime = tmpTime.replace('.','-')
102 # workflowdirArchive = workflowdirArchive[:len(workflowdirArchive)-1] + '_' + tmpTime + '/'
103 # os.mkdir(workflowdirArchive)
104  for n in range(1,100000):
105  tryDir = workflowdirArchive[:len(workflowdirArchive)-1] + '_' + str(n) + '/'
106  if not os.path.isdir(tryDir):
107  workflowdirArchive = tryDir
108  os.mkdir(workflowdirArchive)
109  break
110  elif n == 100000-1:
111  exit('ERROR: Unbelievable! do you ever clean ' + workflowdir + '?. I think you have to remove some directories!')
112 
113  for ifile in tmplistoffiles:
114  if ifile.find('.txt') != -1:
115  if os.path.isfile(workflowdirArchive+"/"+ifile):
116  if option.overwrite:
117  print("File " + ifile + " already exists in destination. We will overwrite it.")
118  else:
119  print("File " + ifile + " already exists in destination. Keep original file.")
120  listoffiles.append( workflowdirArchive + ifile )
121  continue
122  listoffiles.append( workflowdirArchive + ifile )
123  # copy to local disk
124  aCommand = cpCommand + 'cp '+ path + ifile + " " + workflowdirArchive
125  print(" >> " + aCommand)
126  tmpstatus = subprocess.getstatusoutput( aCommand )
127  return listoffiles
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const uint16_t range(const Frame &aFrame)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)
def createPayload.mkWorkflowdir ( )

Definition at line 128 of file createPayload.py.

References copyToWorkflowdir(), beamvalidation.exit(), parse(), and print().

129 def mkWorkflowdir():
130  global workflowdir
131  global workflowdirLastPayloads
132  global workflowdirTmp
133  global workflowdirArchive
134  if not os.path.isdir(workflowdir):
135  print("Making " + workflowdir + " directory...")
136  os.mkdir(workflowdir)
137 
138  if not os.path.isdir(workflowdirLastPayloads):
139  os.mkdir(workflowdirLastPayloads)
140  else:
141  os.system("rm -f "+ workflowdirLastPayloads + "*")
142 
143  if not os.path.isdir(workflowdirTmp):
144  os.mkdir(workflowdirTmp)
145  else:
146  os.system("rm -f "+ workflowdirTmp + "*")
147 
148  if not os.path.isdir(workflowdirArchive):
149  os.mkdir(workflowdirArchive)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Variable Documentation

string createPayload.allbeam_file = workflowdirArchive+"AllIOVs/"

Definition at line 256 of file createPayload.py.

tuple createPayload.allfile = open( allbeam_file, 'a')

Definition at line 259 of file createPayload.py.

tuple createPayload.alllines = mergedfile.readlines()

Definition at line 218 of file createPayload.py.

tuple createPayload.alumi = line.split()

Definition at line 240 of file createPayload.py.

string createPayload.alumis = ''

Definition at line 232 of file createPayload.py.

tuple createPayload.arun = ''

Definition at line 231 of file createPayload.py.

tuple createPayload.atime = line.split()

Definition at line 225 of file createPayload.py.

createPayload.beam_file = sortedlist[key]

WRITE sqlite file.

Definition at line 291 of file createPayload.py.

list createPayload.beam_file_tmp = workflowdirTmp+beam_file[beam_file.rfind('/')+1:]

Definition at line 301 of file createPayload.py.

list createPayload.block = alllines[i * 23: (i+1)*23]

Definition at line 221 of file createPayload.py.

Referenced by L1TMP7ZeroSupp.analyze(), PFAlgo.createCandidatesHF(), DTScalerInfoTask.endLuminosityBlock(), PFEGammaAlgo.evaluateSingleLegMVA(), l1t::MP7BufferDumpToRaw.formatAMC(), l1t::MP7BufferDumpToRaw.getBlocks(), reco::mlpf.getPFElements(), RBCProcessRPCDigis.initialize(), RBCProcessRPCSimDigis.initialize(), PFEGammaFilters.isElectronSafeForJetMET(), PFEGammaFilters.isPhotonSafeForJetMET(), HcalPatternSource.loadPatternFile(), ProcessTestSignal.next(), RBCProcessRPCSimDigis.next(), gen::ParameterCollector::const_iterator.next(), reco::tau::RecoTauElectronRejectionPlugin.operator()(), PFEGammaAlgo.operator()(), l1t::stage2::CaloLayer1Packer.pack(), l1t::stage2::BMTFPackerOutput.pack(), PFAlgo.processBlock(), PFAnalysis.processBlocks(), PFBlockProducer.produce(), SimPFProducer.produce(), l1t::L1TRawToDigi.produce(), l1t::L1TDigiToRaw.produce(), PFAlgo.reconstructParticles(), gen::Pythia6Service.setSLHAFromHeader(), Herwig6Hadronizer.setSLHAFromHeader(), StraightTrackAlignment.StraightTrackAlignment(), and CSCSPRecord.unpack().

string createPayload.checkType = tagType

Definition at line 383 of file createPayload.py.

string createPayload.destDB = 'oracle://cms_orcon_prod/CMS_COND_31X_BEAMSPOT'

Definition at line 271 of file createPayload.py.

tuple createPayload.dfile = open(metadata_file,'w')

Definition at line 372 of file createPayload.py.

string createPayload.dropbox = "/DropBox"

Definition at line 407 of file createPayload.py.

string createPayload.final_sqlite_file_name = tagname+'@'

Definition at line 392 of file createPayload.py.

string createPayload.iov_comment = 'Beam spot position'

Definition at line 275 of file createPayload.py.

tuple createPayload.iov_since = '1'

Definition at line 278 of file createPayload.py.

createPayload.iov_since_first = '1'

Definition at line 268 of file createPayload.py.

tuple createPayload.iov_till = ''

Definition at line 279 of file createPayload.py.

createPayload.IOVbase = 'runbase'

Definition at line 202 of file createPayload.py.

tuple createPayload.keys = sorted(sortedlist.keys())

Definition at line 251 of file createPayload.py.

string createPayload.line = block[0]

Definition at line 224 of file createPayload.py.

tuple createPayload.listoffiles = copyToWorkflowdir(option.data)

Definition at line 210 of file createPayload.py.

tuple createPayload.mergedfile = open(beam_file)

Definition at line 217 of file createPayload.py.

string createPayload.metadata_file = workflowdirTmp+sqlite_file_name+'.txt'

Definition at line 286 of file createPayload.py.

tuple createPayload.newtmpfile = open(beam_file_tmp,"w")

Definition at line 302 of file createPayload.py.

int createPayload.nfile = 0

Definition at line 267 of file createPayload.py.

tuple createPayload.npayloads = len(alllines)

Definition at line 219 of file createPayload.py.

string createPayload.optionstring = ''

Definition at line 50 of file createPayload.py.

tuple createPayload.readdb_template = os.getenv("CMSSW_BASE")

Definition at line 283 of file createPayload.py.

createPayload.skip = False

Definition at line 233 of file createPayload.py.

Referenced by UCTDAQRawData.amc13TrailerPtr(), UCTDAQRawData.amcPayload(), ParticleDecayDrawer.analyze(), EcalDCCHeaderDisplay.analyze(), PhotonValidator.analyze(), ZToMuMuGammaAnalyzer.analyze(), ExternalLHEProducer.beginRunProduce(), BPHRecoBuilder.build(), SiStripCondObjBuilderFromDb.buildAnalysisRelatedObjects(), UCTDAQRawData.cdfTrailerPtr(), PFAlgo.checkCleaning(), DDExpandedViewDump(), ParticleDecayDrawer.decay(), PFFilter.filter(), PFMETFilter.filter(), ConfigurableAnalysis.filter(), ExternalLHEProducer.generateRunInfo(), SiStripPedestals.get10bits(), SiStripNoises.get9bits(), L1MuBMTEtaPatternLut.getIgnoredLines(), L1MuBMTQualPatternLut.getIgnoredLines(), HLTmmkFilter.hltFilter(), HLTmmkkFilter.hltFilter(), cond::persistency.importIovs(), MeasurementTrackerEventProducer.MeasurementTrackerEventProducer(), PFAlgo.postCleaning(), L1TMicroGMTInputProducer.produce(), PFAlgo.recoTracksNotHCAL(), GEMEfficiencyAnalyzer.skipGEMStation(), GEMEfficiencyAnalyzer.skipLayer(), and amc13::Packet.write().

dictionary createPayload.sortedlist = {}

Definition at line 212 of file createPayload.py.

string createPayload.sqlite_file = workflowdirTmp+sqlite_file_name+'.db'

READ and check sqlite file.

Merge sqlite files CREATE payload for merged output

Definition at line 285 of file createPayload.py.

createPayload.sqlite_file_name = tagname+suffix

Definition at line 284 of file createPayload.py.

string createPayload.suffix = "_"

Definition at line 281 of file createPayload.py.

createPayload.tagname = ''

Definition at line 183 of file createPayload.py.

Referenced by templateHelper::SiPixelTitles_Display< PayloadType, StoreType, TransientType >.fill(), templateHelper::SiPixelHeaderTable< PayloadType, StoreType, TransientType >.fill(), BeamSpotPI::DisplayParameters< PayloadType >.fill(), gainCalibHelper::SiPixelGainCalibrationMap< myType, PayloadType, myDetType >.fill(), LumiProducer.getCurrentDataTag(), EgammaHLTPhase2ExtraProducer::Tokens.setToken(), and EgammaHLTExtraProducer::Tokens.setToken().

string createPayload.tagType = ''

Definition at line 51 of file createPayload.py.

string createPayload.timetype = 'runnumber'

Definition at line 203 of file createPayload.py.

string createPayload.tmp_datafilename = workflowdirTmp+"tmp_datafile.txt"

Definition at line 292 of file createPayload.py.

tuple createPayload.tmp_lumi_since = ""

Definition at line 304 of file createPayload.py.

tuple createPayload.tmp_lumi_till = ""

Definition at line 305 of file createPayload.py.

tuple createPayload.tmp_run = ""

Definition at line 303 of file createPayload.py.

tuple createPayload.tmpfile = open(beam_file)

Definition at line 229 of file createPayload.py.

tuple createPayload.total_files = len(keys)

Definition at line 269 of file createPayload.py.

tuple createPayload.uuid = subprocess.getstatusoutput('uuidgen -t')

Definition at line 391 of file createPayload.py.

Referenced by TriggerMenu.setGtTriggerMenuUUID(), l1t::TriggerMenuParser.setGtTriggerMenuUUID(), and GlobalAlgBlk.setL1MenuUUID().

string createPayload.workflowdir = 'test/workflow/'

3

Definition at line 46 of file createPayload.py.

string createPayload.workflowdirArchive = workflowdir+'archive/'

Definition at line 49 of file createPayload.py.

string createPayload.workflowdirLastPayloads = workflowdir+'lastPayloads/'

Definition at line 47 of file createPayload.py.

string createPayload.workflowdirTmp = workflowdir+'tmp/'

Definition at line 48 of file createPayload.py.

tuple createPayload.writedb_template = os.getenv("CMSSW_BASE")

Definition at line 282 of file createPayload.py.