Skip to content

Commit

Permalink
EL9 / python3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuel Lorenz Pfeffer committed Oct 2, 2024
1 parent 889fd3e commit 9a8a08c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 8 deletions.
47 changes: 41 additions & 6 deletions toolbox/condorSubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,55 @@

import toolbox.printer as printer


## universe = vanilla and run_as_owner = true removed (admin hint)
# periodic_release = (HoldReasonCode == 26) && (NumJobStarts < 4) ## resubmit automatically if runtime expires (code 26)
submitTemplateNAF = """
universe = vanilla
executable = /bin/zsh
arguments = {arg}
error = {dir}/{name}submitScript.$(Cluster)_$(ProcId).err
log = {dir}/{name}submitScript.$(Cluster)_$(ProcId).log
output = {dir}/{name}submitScript.$(Cluster)_$(ProcId).out
run_as_owner = true
Requirements = ( OpSysAndVer == "CentOS7" )
RequestMemory = {memory}
RequestDisk = {disk}
Request_OpSysAndVer = "RedHat9"
+RequestRuntime = {runtime}
Request_Cpus = {ncores}
JobBatchName = {batchname}
"""

# submitTemplateNAF = """
# universe = vanilla
# executable = /bin/zsh
# arguments = {arg}
# error = {dir}/{name}submitScript.$(Cluster)_$(ProcId).err
# log = {dir}/{name}submitScript.$(Cluster)_$(ProcId).log
# output = {dir}/{name}submitScript.$(Cluster)_$(ProcId).out
# run_as_owner = true
# Requirements = ( OpSysAndVer == "CentOS7" )
# RequestMemory = {memory}
# RequestDisk = {disk}
# +RequestRuntime = {runtime}
# Request_Cpus = {ncores}
# JobBatchName = {batchname}
# """

#submitTemplateNAF = """
#universe = vanilla
#executable = /bin/zsh
#arguments = {arg}
#error = {dir}/{name}submitScript.$(Cluster)_$(ProcId).err
#log = {dir}/{name}submitScript.$(Cluster)_$(ProcId).log
#output = {dir}/{name}submitScript.$(Cluster)_$(ProcId).out
#run_as_owner = true
#RequestMemory = {memory}
#RequestDisk = {disk}
#+RequestRuntime = {runtime}
#+MySingularityImage = "/cvmfs/singularity.opensciencegrid.org/cmssw/cms:rhel7"
#Request_Cpus = {ncores}
#JobBatchName = {batchname}
#"""

submitTemplateETP = """
universe = docker
executable = /bin/zsh
Expand Down Expand Up @@ -61,9 +94,9 @@ def submitToBatch(workdir, list_of_shells, memory_ = "1000", disk_ = "1000000",
def writeArrayScript(workdir, files, name_):
path = os.path.abspath(workdir+"/"+name_+"_arraySubmit.sh")
files = [os.path.abspath(f) for f in files]

code = """

#!/bin/bash
code = """
subtasklist=(
%(tasks)s
)
Expand Down Expand Up @@ -136,7 +169,8 @@ def condorSubmit(submitPath):
process.wait()
output = process.communicate()
try:
jobID = int(str(output[0]).split(".")[0])
# jobID = int(str(output[0]).split(".")[0])
jobID = int(str(output[0].decode('utf-8')).split(".")[0]) #EP python3 update
except:
return
print("something went wrong with calling the condir_submit command, submission of jobs was not successful")
Expand Down Expand Up @@ -189,6 +223,7 @@ def monitorJobStatus(jobIDs = None, queryInterval = 60, nTotalJobs = None):
a.wait()
qstat = a.communicate()[0]
nrunning = 0
qstat = qstat.decode('utf-8') # EP added for python3 update
querylines = [line for line in qstat.split("\n") if "Total for query" in line]

# check if query matches
Expand Down
2 changes: 1 addition & 1 deletion toolbox/harryPlotter/HistogramSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def getPlotRange(self, stackedHistograms, lineHistograms):
'''
yMax = 0.
yMinMax = 1e10
hists = lineHistograms.values()
hists = list(lineHistograms.values()) #EP changed due to python3
if len(stackedHistograms) > 0:
hists.append(stackedHistograms[-1])
for h in hists:
Expand Down
2 changes: 1 addition & 1 deletion toolbox/harryPlotter/harryPlotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def loadFromSystFile(self, systFile, cloneProcesses = {}):

# prune systematics file
columns = ["Uncertainty", "Type", "SysGroup"]+self.processNames
self.sf.drop(self.sf.columns.difference(columns), 1, inplace = True)
self.sf.drop(self.sf.columns.difference(columns), axis = 1, inplace = True)
self.sf = self.sf[columns]

# drop all unneccessary lines
Expand Down
2 changes: 2 additions & 0 deletions toolbox/plotSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ def printCMSLabel(pad, privateWork = True, plotLabel = "private work",
latex.SetTextColor(ROOT.kBlack)
latex.SetTextSize(0.04)

# EP changed
text = "CMS"
if privateWork: text += " #bf{#it{"+plotLabel+"}}"
# text = "#bf{"+plotLabel+"}"
x = 0.
y = 0.
if ratio:
Expand Down

0 comments on commit 9a8a08c

Please sign in to comment.