Skip to content

Commit

Permalink
python3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Wassmer committed Aug 2, 2024
1 parent 5c934c7 commit 9df9499
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions karim/submit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from writeScripts import writeScripts
from checkFiles import checkFiles
from karim.submit.writeScripts import writeScripts
from karim.submit.checkFiles import checkFiles
2 changes: 1 addition & 1 deletion karim/submit/checkFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import ROOT

from common import getEntries
from karim.submit.common import getEntries

def checkFiles(sample, mode, nameRequirement, shellPath, outPath):
'''
Expand Down
6 changes: 3 additions & 3 deletions karim/submit/condorSubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
log = {dir}/{name}submitScript.$(Cluster)_$(ProcId).log
output = {dir}/{name}submitScript.$(Cluster)_$(ProcId).out
run_as_owner = true
Requirements = ( OpSysAndVer == "CentOS7" )
Requirements = ( OpSysAndVer == "RedHat9" )
RequestMemory = {memory}
RequestDisk = {disk}
+RequestRuntime = {runtime}
Expand Down Expand Up @@ -133,7 +133,7 @@ def condorSubmit(submitPath):
process.wait()
output = process.communicate()
try:
jobID = int(output[0].split(".")[0])
jobID = int(output[0].decode().split(".")[0])
except:
print("something went wrong with calling the condir_submit command, submission of jobs was not successful")
print("DEBUG:")
Expand Down Expand Up @@ -168,7 +168,7 @@ def monitorJobStatus(jobIDs = None):
qstat = a.communicate()[0]

nrunning = 0
querylines = [line for line in qstat.split("\n") if "Total for query" in line]
querylines = [line for line in qstat.decode().split("\n") if "Total for query" in line]

# check if query matches
if len(querylines) == 0:
Expand Down
4 changes: 1 addition & 3 deletions karim/submit/writeScripts.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import glob
import os
import ROOT
from common import getEntries
from karim.submit.common import getEntries

scriptTemplate = """
#!/bin/bash
export VO_CMS_SW_DIR=/cvmfs/cms.cern.ch
source $VO_CMS_SW_DIR/cmsset_default.sh
export SCRAM_ARCH=slc7_amd64_gcc700
cd {cmssw}/src
eval `scram runtime -sh`
cd -
source {basepath}/venv/bin/activate
export KERAS_BACKEND=tensorflow
"""
recoTemplate = """
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateSubmitScripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@

cmd = " ".join([
"for f in *;",
"do python {basedir}/karim/submit/condorSubmit.py",
"do python3 {basedir}/karim/submit/condorSubmit.py",
"-f $f -o ../submit_{name} -M 2000 -r 120 -n {mode}_$f;",
"done"]).format(
mode = "karim_"+opts.mode.lower(),
Expand Down

0 comments on commit 9df9499

Please sign in to comment.