Skip to content
Snippets Groups Projects
Commit 02fb2a26 authored by Papeleux Luc's avatar Papeleux Luc
Browse files

debug RunBatch for delayed start

parent d97e392e
No related branches found
No related tags found
No related merge requests found
......@@ -265,18 +265,34 @@ class ParametricJob(PRMSet):
# AT/BATCH SPECIFIC
def runBatch(self):
# get guess profile
cfgfile = self.guessProfile()
cfgfile = self.guessProfile()
cfgFileName, cfgFileExtension = os.path.splitext(self.cfgfile)
import re
m = re.compile(cfgFileName+'([0-9]+)\.'+cfgFileExtension)
launchId = 0
for fn in os.listdir('.'):
out = m.search(fn)
if out :
outId = int(out.group(1))
if outId > launchId :
lauchId = outId
launchId +=1
print ("launchId =", launchId)
os.system("cp %s %s%s%s"%(self.cfgfile, cfgFileName, launchId, cfgFileExtension))
# build script
scriptname="runbatch.sh"
scriptname="runbatch%d.sh"%launchId
file = open(scriptname,"w")
file.write("#!/bin/bash\n") # this avoids /bin/sh when sh=dash
file.write(". %s\n" % cfgfile)
file.write("echo `atq`\n")
file.write("jobId=`atq | awk '{if ($1>jobId)jobId=$1} END {print jobId}'`\n")
file.write("echo \"at JobId = $jobId\"\n")
file.write('%s -x -i $jobId -d "%s"\n' % (sys.argv[0], os.getcwd()) )
#file.write("echo `atq`\n")
#file.write("jobId=`atq | awk '{if ($1>jobId)jobId=$1} END {print jobId}'`\n")
#file.write("echo \"at JobId = $jobId\"\n")
#file.write('%s -x -i $jobId -d "%s"\n' % (sys.argv[0], os.getcwd()) )
file.write('%s -x -i %d -d "%s"\n' % (sys.argv[0], launchId, os.getcwd()) )
file.close()
os.chmod(scriptname,0o700)
print("starting script in batch mode: %s" % scriptname)
#shcmd="at %s -f %s" % (self.pars['BATCHTIME'].val, scriptname)
if self.pars['RUNMETHOD'].val == "at" :
......@@ -300,8 +316,8 @@ class ParametricJob(PRMSet):
batchId = m.group(1)
#print m.group
if m:
cfgFileName, cfgFileExtension = os.path.splitext(self.cfgfile)
os.system("cp %s %s%s%s"%(self.cfgfile, cfgFileName, batchId, cfgFileExtension))
#cfgFileName, cfgFileExtension = os.path.splitext(self.cfgfile)
#os.system("cp %s %s%s%s"%(self.cfgfile, cfgFileName, batchId, cfgFileExtension))
self.atrmScript(batchId)
print("\tuse 'atq' and find job number %s to check the status of your job" % batchId)
print("\t\t - 'a' means waiting in the queue 'a'")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment