Skip to content
Snippets Groups Projects
Commit def5d077 authored by Franck Dary's avatar Franck Dary
Browse files

updated script launchBatches so that it doesn't send more than 2 jobs without bestEffort

parent 81a9cabc
No related branches found
No related tags found
No related merge requests found
...@@ -18,11 +18,11 @@ def prepareExperiment(lang, template, expName) : ...@@ -18,11 +18,11 @@ def prepareExperiment(lang, template, expName) :
############################################################################### ###############################################################################
############################################################################### ###############################################################################
def launchTrain(mode, expName, arguments, launcher, nbHours, jobIndex) : def launchTrain(mode, expName, arguments, launcher, nbHours) :
if launcher == "bash" : if launcher == "bash" :
launchTrainBash(mode, expName, arguments) launchTrainBash(mode, expName, arguments)
elif launcher == "oar" : elif launcher == "oar" :
launchTrainOar(mode, expName, arguments, nbHours, jobIndex) launchTrainOar(mode, expName, arguments, nbHours)
else : else :
printUsageAndExit() printUsageAndExit()
############################################################################### ###############################################################################
...@@ -35,12 +35,19 @@ def launchTrainBash(mode, expName, arguments) : ...@@ -35,12 +35,19 @@ def launchTrainBash(mode, expName, arguments) :
############################################################################### ###############################################################################
############################################################################### ###############################################################################
def launchTrainOar(mode, expName, arguments, nbHours, jobIndex) : def nbMaxLongJobs() :
return 2
###############################################################################
###############################################################################
def launchTrainOar(mode, expName, arguments, nbHours) :
devScore = "--devScore" devScore = "--devScore"
bestEffort = getOarNbLongJobs() >= nbMaxLongJobs()
command = "oarsub" command = "oarsub"
command += " -t besteffort" if jobIndex > 1 else "" command += " -t besteffort" if bestEffort else ""
command += " -t idempotent" if jobIndex > 1 else "" command += " -t idempotent" if bestEffort else ""
command += " -n train:%s"%expName command += " -n train:%s"%expName
command += " -E %s.stderr"%expName command += " -E %s.stderr"%expName
command += " -O %s.stdout"%expName command += " -O %s.stdout"%expName
...@@ -52,11 +59,11 @@ def launchTrainOar(mode, expName, arguments, nbHours, jobIndex) : ...@@ -52,11 +59,11 @@ def launchTrainOar(mode, expName, arguments, nbHours, jobIndex) :
############################################################################### ###############################################################################
############################################################################### ###############################################################################
def launchEval(mode, expName, launcher, nbHours, jobIndex) : def launchEval(mode, expName, launcher, nbHours) :
if launcher == "bash" : if launcher == "bash" :
launchEvalBash(mode, expName) launchEvalBash(mode, expName)
elif launcher == "oar" : elif launcher == "oar" :
launchEvalOar(mode, expName, nbHours, jobIndex) launchEvalOar(mode, expName, nbHours)
else : else :
printUsageAndExit() printUsageAndExit()
############################################################################### ###############################################################################
...@@ -68,10 +75,12 @@ def launchEvalBash(mode, expName) : ...@@ -68,10 +75,12 @@ def launchEvalBash(mode, expName) :
############################################################################### ###############################################################################
############################################################################### ###############################################################################
def launchEvalOar(mode, expName,nbHours, jobIndex) : def launchEvalOar(mode, expName,nbHours) :
bestEffort = getOarNbLongJobs() >= nbMaxLongJobs()
command = "oarsub" command = "oarsub"
command += " -t besteffort" if jobIndex > 1 else "" command += " -t besteffort" if bestEffort else ""
command += " -t idempotent" if jobIndex > 1 else "" command += " -t idempotent" if bestEffort else ""
command += " -n eval:%s"%expName command += " -n eval:%s"%expName
command += " -E %s.stderr"%expName command += " -E %s.stderr"%expName
command += " -O %s.stdout"%expName command += " -O %s.stdout"%expName
...@@ -82,6 +91,13 @@ def launchEvalOar(mode, expName,nbHours, jobIndex) : ...@@ -82,6 +91,13 @@ def launchEvalOar(mode, expName,nbHours, jobIndex) :
os.system(command) os.system(command)
############################################################################### ###############################################################################
###############################################################################
def getOarNbLongJobs() :
return int(subprocess.Popen('oarstat -u | grep "Q=long" | wc -l',
shell=True, stdout=subprocess.PIPE).stdout.read())
###############################################################################
############################################################################### ###############################################################################
if __name__ == "__main__" : if __name__ == "__main__" :
if len(sys.argv) < 4 : if len(sys.argv) < 4 :
...@@ -105,7 +121,6 @@ if __name__ == "__main__" : ...@@ -105,7 +121,6 @@ if __name__ == "__main__" :
desc = __import__(os.path.splitext(batchesDescription)[0]) desc = __import__(os.path.splitext(batchesDescription)[0])
jobIndex = 0
for lang in desc.langs : for lang in desc.langs :
for xp in desc.templatesExperiments : for xp in desc.templatesExperiments :
for i in range(desc.nbReplicas) : for i in range(desc.nbReplicas) :
...@@ -113,9 +128,9 @@ if __name__ == "__main__" : ...@@ -113,9 +128,9 @@ if __name__ == "__main__" :
xp['expName'] = xp['expName'].split('.')[0]+"."+lang+"."+str(i) xp['expName'] = xp['expName'].split('.')[0]+"."+lang+"."+str(i)
if mode == "train" : if mode == "train" :
prepareExperiment(xp['lang'],xp['template'],xp['expName']) prepareExperiment(xp['lang'],xp['template'],xp['expName'])
launchTrain(xp['mode'],xp['expName'],xp['arguments'],launcher,nbHours,jobIndex) launchTrain(xp['mode'],xp['expName'],xp['arguments'],launcher,nbHours)
else : else :
launchEval(xp['mode'],xp['expName'],launcher,nbHours,jobIndex) launchEval(xp['mode'],xp['expName'],launcher,nbHours)
############################################################################### ###############################################################################
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