Commit d8d54985 authored by snuverink_j's avatar snuverink_j
Browse files

remove option --block; fixes #5

parent 0c5ad1a2
......@@ -50,13 +50,12 @@ def getBaseName():
return name
def printUsage():
print "./runOPAL.py [--restart-file=FILE [--restart-step=STEPNR | --restart-pos=POS]] [--info num] [--test] [--block] [--keep] [ATTR=SCANVALUE] {[ATTR=VALUE]}"
print "./runOPAL.py [--restart-file=FILE [--restart-step=STEPNR | --restart-pos=POS]] [--info num] [--test] [--keep] [ATTR=SCANVALUE] {[ATTR=VALUE]}"
print ""
print "Unit of POS is meter."
print "SCANVALUE=start:end:step, example TFWHM=0.85:0.90:0.01 "
print ""
print "--test does everything but submitting the job"
print "--block run opal in batch system and wait until the job is done"
print "--keep if same simulation has been run before, keep old data and abort"
print "--nobatch run opal locally not using the batch system and waits until the job is done"
print "--optPilot run optPilot (at the moment with default MOGA settings on host merlinl01.psi.ch)"
......@@ -100,7 +99,6 @@ def main(argv):
N = -1 # a running number; if given use it to label directory!
doTest = False
doBlock = False
doKeep = False
doNobatch = False
doOptPilot = False
......@@ -120,8 +118,6 @@ def main(argv):
elif arg.startswith("--restart-pos"):
restart_pos = arg.split("=")[1]
restart_step = str(getNearestRestartStep(restart_pos,restart_file))
elif arg.startswith("--block"):
doBlock = True
elif arg.startswith("--keep"):
doKeep = True
elif arg.startswith("--nobatch"):
......@@ -176,14 +172,14 @@ def main(argv):
if doOptPilot:
opt = Runoptpilot(opaldict)
qid = opt.run(N, baseFileName, restart_step, inputfilePath, tmplFile, oinpFile, restart_file, doTest, doBlock, doKeep, doNobatch)
qid = opt.run(N, baseFileName, restart_step, inputfilePath, tmplFile, oinpFile, restart_file, doTest, doKeep, doNobatch)
if doNobatch:
print "... finished!\n"
else:
print "SGE-ID= ",qid,'\n'
elif not opaldict.hasRanges():
sim = Simulation(opaldict)
qid = sim.run(N, baseFileName, restart_step, inputfilePath, tmplFile, oinpFile, restart_file, doTest, doBlock, doKeep, doNobatch, info, queue)
qid = sim.run(N, baseFileName, restart_step, inputfilePath, tmplFile, oinpFile, restart_file, doTest, doKeep, doNobatch, info, queue)
if doNobatch:
print "... finished!\n"
else:
......@@ -213,7 +209,7 @@ def main(argv):
print ranges
#run simulations of all possible combinations
args = [N, baseFileName, restart_step, inputfilePath, tmplFile, oinpFile, restart_file, doTest, doBlock, doKeep, doNobatch, info, queue]
args = [N, baseFileName, restart_step, inputfilePath, tmplFile, oinpFile, restart_file, doTest, doKeep, doNobatch, info, queue]
traverseRanges(ranges.items(), opaldict, args)
# clean up
os.system("rm -f *.bak ")
......
......@@ -39,7 +39,7 @@ class Runoptpilot:
os.mkdir(self.dirname)
return True
def run(self,N, baseFileName, restart_step, inputfilePath, tmplFile, oinpFile, restart_file, doTest, doBlock, doKeep, doNobatch):
def run(self,N, baseFileName, restart_step, inputfilePath, tmplFile, oinpFile, restart_file, doTest, doKeep, doNobatch):
CORES = int(self.opaldict['CORES'])
if CORES == 0:
......
......@@ -40,7 +40,7 @@ class Simulation:
os.mkdir(self.dirname)
return True
def run(self,N, baseFileName, restart_step, inputfilePath, tmplFile, oinpFile, restart_file, doTest, doBlock, doKeep, doNobatch, info, queue):
def run(self,N, baseFileName, restart_step, inputfilePath, tmplFile, oinpFile, restart_file, doTest, doKeep, doNobatch, info, queue):
# make directory name indicating changed values
self.dirname = baseFileName
if N >= 0:
......@@ -197,19 +197,8 @@ class Simulation:
elif batchsys == 'PBS':
print 'Done with setup of the OPAL simulation, please submit the job yourself'
if doBlock:
print "Blocking mode on...\n"
username = commands.getoutput("whoami")
qstatout = commands.getoutput("qstat -u " + username + " | grep \"" + qid + "\"")
while len(qstatout) > 0:
# we only check every 30 seconds if job has finished
time.sleep(30)
qstatout = commands.getoutput("qstat -u " + username + " | grep \"" + qid + "\"")
os.chdir('..')
return -1
else:
os.chdir('..')
return qid
os.chdir('..')
return qid
def WriteCori(self, opalexe, oinpFile, cores, time, ram, info, name):
title=oinpFile.partition(".")[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment