Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions condDatasetSubmitter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#! /usr/bin/env python

from __future__ import print_function
import ast
import os
import sys
Expand Down Expand Up @@ -98,8 +99,8 @@ def createOptionParser():


CMSSW_VERSION = 'CMSSW_VERSION'
if not os.environ.has_key(CMSSW_VERSION):
print "\n CMSSW not properly set. Exiting"
if CMSSW_VERSION not in os.environ:
print("\n CMSSW not properly set. Exiting")
sys.exit(1)

options.release = os.getenv(CMSSW_VERSION)
Expand Down Expand Up @@ -180,11 +181,11 @@ def isAtSite(ds, run):
blocks.append('#' + block.split('#')[-1])

if len(blocks) == 0:
print "No possible block for %s in %s" % (run, ds)
print("No possible block for %s in %s" % (run, ds))
return False
else:
print "\n\n\t Block testing succeeded for %s in %s \n\n" % (run, ds)
print blocks
print("\n\n\t Block testing succeeded for %s in %s \n\n" % (run, ds))
print(blocks)
return list(set(blocks))

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -363,12 +364,12 @@ def getDriverDetails(Type, release, ds, B0T, HIon, pA, recoRelease):

def execme(command):
if DRYRUN:
print command
print(command)
else:
print " * Executing: %s..." % command
print(" * Executing: %s..." % command)
##TO-DO: rewrite to subprocess!
os.system(command)
print " * Executed!"
print(" * Executed!")

#-------------------------------------------------------------------------------
def createHLTConfig(options):
Expand Down Expand Up @@ -400,7 +401,7 @@ def createHLTConfig(options):
execme(cmssw_command + '; ' + hlt_command + '; ' + build_command)
else:
execme(cmssw_command + '; ' + hlt_command + '; ' + patch_command + '; ' + patch_command2 + '; ' + build_command)
print "\n CMSSW release for HLT doesn't allow usage of hltGetConfiguration out-of-the-box, patching configuration "
print("\n CMSSW release for HLT doesn't allow usage of hltGetConfiguration out-of-the-box, patching configuration ")

def createCMSSWConfigs(options,confCondDictionary,allRunsAndBlocks):
details = getDriverDetails(options.Type, options.release, options.ds, options.B0T, options.HIon,options.pA,options.recoRelease)
Expand All @@ -418,7 +419,7 @@ def createCMSSWConfigs(options,confCondDictionary,allRunsAndBlocks):
# Create the drivers
for c in confCondList:
(cfgname,custgt) = c
print "\n\n\tCreating for", cfgname, "\n\n"
print("\n\n\tCreating for", cfgname, "\n\n")
driver_command = "cmsDriver.py %s " % (details['reqtype'])+\
"-s %s " % (details['steps']) +\
"--processName %s " % (details['procname']) +\
Expand Down Expand Up @@ -669,7 +670,7 @@ def createCMSSWConfigs(options,confCondDictionary,allRunsAndBlocks):
'harvest_cfg=step4_refer_HARVESTING.py\n\n' # this is ugly and depends on [0:5]; can't be easliy fixed w/o reorganization

task = 2
print confCondList
print(confCondList)
for (i, c) in enumerate(confCondList):
cfgname = c[0]
if "REFERENCE" in cfgname:
Expand Down Expand Up @@ -795,7 +796,7 @@ def createCMSSWConfigs(options,confCondDictionary,allRunsAndBlocks):
wmcconf.close()

execme('./wmcontrol.py --test --req_file %s' % (wmconf_name))
print 'Now execute:\n./wmcontrol.py --req_file %s |& tee wmcontrol.1.log' % (wmconf_name)
print('Now execute:\n./wmcontrol.py --req_file %s |& tee wmcontrol.1.log' % (wmconf_name))

def printInfo(options):
if "HLT" in options.Type:
Expand Down Expand Up @@ -826,24 +827,24 @@ def printInfo(options):
else:
gtshort = options.gt

print ""
print "type: %s" % (options.Type)
print "dataset: %s" % (",".join(options.ds))
print("")
print("type: %s" % (options.Type))
print("dataset: %s" % (",".join(options.ds)))
#print "run: %s" % (",".join(options.run))
if (options.run):
print "run: %s" % (",".join(options.run))
print("run: %s" % (",".join(options.run)))
elif (options.runLs):
print "run: %s" % (options.runLs)
print("run: %s" % (options.runLs))

if "HLT" in options.Type:
print "HLT menu: %s" % (menu)
print "Target HLT GT: %s" % (newgtshort)
print "Reference HLT GT: %s" % (gtshort)
print("HLT menu: %s" % (menu))
print("Target HLT GT: %s" % (newgtshort))
print("Reference HLT GT: %s" % (gtshort))
if "HLT" in options.Type and "RECO" in options.Type:
print "Common Prompt GT: %s" % (options.basegt)
print("Common Prompt GT: %s" % (options.basegt))
if "PR" in options.Type:
print "Target Prompt GT: %s" % (newgtshort)
print "Reference Prompt GT: %s" % (gtshort)
print("Target Prompt GT: %s" % (newgtshort))
print("Reference Prompt GT: %s" % (gtshort))

#-------------------------------------------------------------------------------

Expand All @@ -861,8 +862,8 @@ def printInfo(options):

# Get the options
options = createOptionParser()
print options.run
print type(options.run)
print(options.run)
print(type(options.run))
# this type is LIST in the normal CASE,
# and it's also list with a single element == dictionary in the LS-filtering case. This is a problem

Expand All @@ -881,7 +882,7 @@ def printInfo(options):
for run in options.run:
newblocks = isAtSite(ds, int(run))
if newblocks == False:
print "Cannot proceed with %s in %s (no suitable blocks found)" % (ds, run)
print("Cannot proceed with %s in %s (no suitable blocks found)" % (ds, run))
sys.exit(1)
else:
allRunsAndBlocks[ds].extend(newblocks)
Expand Down
53 changes: 27 additions & 26 deletions configs/SpecialRequests2012/MatrixReader_AlcaValidW13.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import print_function

import sys

Expand Down Expand Up @@ -84,16 +85,16 @@ def readMatrix(self, fileNameIn, useInput=None, refRel=None, fromScratch=None):

prefix = self.filesPrefMap[fileNameIn]

print "processing ", fileNameIn
print("processing ", fileNameIn)

try:
_tmpMod = __import__( 'Configuration.PyReleaseValidation.'+fileNameIn )
self.relvalModule = sys.modules['Configuration.PyReleaseValidation.'+fileNameIn]
except Exception, e:
print "ERROR importing file ", fileNameIn, str(e)
except Exception as e:
print("ERROR importing file ", fileNameIn, str(e))
return

print "request for INPUT for ", useInput
print("request for INPUT for ", useInput)


fromInput={}
Expand Down Expand Up @@ -254,21 +255,21 @@ def showRaw(self, useInput, refRel=None, fromScratch=None, what='all',step1Only=
self.reset(what)

if self.what != 'all' and self.what not in matrixFile:
print "ignoring non-requested file",matrixFile
print("ignoring non-requested file",matrixFile)
continue

try:
self.readMatrix(matrixFile, useInput, refRel, fromScratch)
except Exception, e:
print "ERROR reading file:", matrixFile, str(e)
except Exception as e:
print("ERROR reading file:", matrixFile, str(e))
raise

if not self.workFlowSteps: continue

dataFileName = matrixFile.replace('relval_', 'cmsDriver_')+'_hlt.txt'
outFile = open(dataFileName,'w')

print "found ", len(self.workFlowSteps.keys()), ' workflows for ', dataFileName
print("found ", len(self.workFlowSteps.keys()), ' workflows for ', dataFileName)
ids = self.workFlowSteps.keys()
ids.sort()
indexAndSteps=[]
Expand Down Expand Up @@ -340,7 +341,7 @@ def showRaw(self, useInput, refRel=None, fromScratch=None, what='all',step1Only=
outFile.write(line+'\n')
outFile.write('\n'+'\n')
outFile.close()
print "wrote ",writtenWF, ' workflow'+('s' if (writtenWF!=1) else ''),' to ', outFile.name
print("wrote ",writtenWF, ' workflow'+('s' if (writtenWF!=1) else ''),' to ', outFile.name)
return


Expand All @@ -349,9 +350,9 @@ def showWorkFlows(self, selected=None, extended=True):
maxLen = 100 # for summary, limit width of output
fmt1 = "%-6s %-35s [1]: %s ..."
fmt2 = " %35s [%d]: %s ..."
print "\nfound a total of ", len(self.workFlows), ' workflows:'
print("\nfound a total of ", len(self.workFlows), ' workflows:')
if selected:
print " of which the following", len(selected), 'were selected:'
print(" of which the following", len(selected), 'were selected:')
#-ap for now:
maxLen = -1 # for individual listing, no limit on width
fmt1 = "%-6s %-35s [1]: %s "
Expand All @@ -360,23 +361,23 @@ def showWorkFlows(self, selected=None, extended=True):
N=[]
for wf in self.workFlows:
if selected and float(wf.numId) not in selected: continue
if extended: print ''
if extended: print('')
#pad with zeros
for i in range(len(N),len(wf.cmds)): N.append(0)
N[len(wf.cmds)-1]+=1
wfName, stepNames = wf.nameId.split('+',1)
for i,s in enumerate(wf.cmds):
if extended:
if i==0:
print fmt1 % (wf.numId, stepNames, (str(s)+' ')[:maxLen])
print(fmt1 % (wf.numId, stepNames, (str(s)+' ')[:maxLen]))
else:
print fmt2 % ( ' ', i+1, (str(s)+' ')[:maxLen])
print(fmt2 % ( ' ', i+1, (str(s)+' ')[:maxLen]))
else:
print "%-6s %-35s "% (wf.numId, stepNames)
print("%-6s %-35s "% (wf.numId, stepNames))
break
print ''
print('')
for i,n in enumerate(N):
if n: print n,'workflows with',i+1,'steps'
if n: print(n,'workflows with',i+1,'steps')

return

Expand All @@ -397,9 +398,9 @@ def createWorkFlows(self, fileNameIn):
num, name, commands, stepList = val
nameId = str(num)+'_'+name
if nameId in self.nameList:
print "==> duplicate name found for ", nameId
print ' keeping : ', self.nameList[nameId]
print ' ignoring : ', val
print("==> duplicate name found for ", nameId)
print(' keeping : ', self.nameList[nameId])
print(' ignoring : ', val)
else:
self.nameList[nameId] = val

Expand All @@ -411,26 +412,26 @@ def prepare(self, useInput=None, refRel='', fromScratch=None):

for matrixFile in self.files:
if self.what != 'all' and self.what not in matrixFile:
print "ignoring non-requested file",matrixFile
print("ignoring non-requested file",matrixFile)
continue

try:
self.readMatrix(matrixFile, useInput, refRel, fromScratch)
except Exception, e:
print "ERROR reading file:", matrixFile, str(e)
except Exception as e:
print("ERROR reading file:", matrixFile, str(e))
raise

try:
self.createWorkFlows(matrixFile)
except Exception, e:
print "ERROR creating workflows :", str(e)
except Exception as e:
print("ERROR creating workflows :", str(e))
raise


def show(self, selected=None, extended=True):

self.showWorkFlows(selected,extended)
print '\n','-'*80,'\n'
print('\n','-'*80,'\n')


def updateDB(self):
Expand Down
15 changes: 8 additions & 7 deletions configs/SpecialRequests2012/relval_steps_AlcaValidW13.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import print_function


class Matrix(dict):
def __setitem__(self,key,value):
if key in self:
print "ERROR in Matrix"
print "overwritting",key,"not allowed"
print("ERROR in Matrix")
print("overwritting",key,"not allowed")
import sys
sys.exit(-9)
else:
Expand All @@ -15,8 +16,8 @@ def __setitem__(self,key,value):
class Steps(dict):
def __setitem__(self,key,value):
if key in self:
print "ERROR in Step"
print "overwritting",key,"not allowed"
print("ERROR in Step")
print("overwritting",key,"not allowed")
import sys
sys.exit(-9)
else:
Expand All @@ -26,7 +27,7 @@ def __setitem__(self,key,value):

def overwrite(self,keypair):
value=self[keypair[1]]
print "overwritting step",keypair[0],"with",keypair[1],str(value)
print("overwritting step",keypair[0],"with",keypair[1],str(value))
self.update({keypair[0]:value})

class WF(list):
Expand Down Expand Up @@ -67,13 +68,13 @@ def __str__(self):
def merge(dictlist,TELL=False):
import copy
last=len(dictlist)-1
if TELL: print last,dictlist
if TELL: print(last,dictlist)
if last==0:
# ONLY ONE ITEM LEFT
return copy.copy(dictlist[0])
else:
reducedlist=dictlist[0:max(0,last-1)]
if TELL: print reducedlist
if TELL: print(reducedlist)
# make a copy of the last item
d=copy.copy(dictlist[last])
# update with the last but one item
Expand Down
Loading