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

fix launchGuy for non interactive use (at, batch, slurm,...) by replacing...

fix launchGuy for non interactive use (at, batch, slurm,...) by replacing '*Guy.pyw' by '*.py' in runBatch, runSge, runSlurm,... I also add a test to not close the gui when launching a nonInteractive job
parent 8927baee
No related branches found
No related tags found
No related merge requests found
self.pars['NB_THREADS'].val='6'
self.pars['NB_THREADS'].val='4'
self.pars['NB_TASKS'].val='1'
self.pars['RUNMETHOD'].vals=['interactive','at','batch']
self.pars['RUNMETHOD'].val='batch'
......@@ -296,7 +296,8 @@ class ParametricJob(PRMSet):
#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()) )
script = re.sub(r'(.+)Gui.pyw',r'\1.py', sys.argv[0]) #if launched through a Gui => use the basic script instead in batch
file.write('%s -x -i %d -d "%s"\n' % (script, launchId, os.getcwd()) )
file.close()
os.chmod(scriptname,0o700)
......@@ -331,7 +332,9 @@ class ParametricJob(PRMSet):
print("\t\t - '=' means running")
print("\tuse 'atrm %s to kill the job" % batchId)
print("\t\t or 'atrm%s.py' to kill the job" % batchId)
sys.exit()
# to avoid closing the gui
if not (re.match(r'(.+)Gui.pyw', sys.argv[0])):
sys.exit()
def atrmScript(self, pid):
filename = "atrm%s.py"%pid
......@@ -391,7 +394,10 @@ class ParametricJob(PRMSet):
file.write("#$ %s\n" % self.pars['SGEARGS'].val)
import socket
file.write(". %s %s\n" % (cfgfile,socket.gethostname()))
file.write("%s -x -i $JOB_ID\n" % (sys.argv[0]))
#file.write('%s -x -i $jobId -d "%s"\n' % (sys.argv[0], os.getcwd()) )
script = re.sub(r'(.+)Gui.pyw',r'\1.py', sys.argv[0])
file.write("%s -x -i $JOB_ID\n" % (script))
#file.write("%s -x -i $JOB_ID\n" % (sys.argv[0]))
file.close()
# send to sge
print("sending job '%s' to SGE" % jobname)
......@@ -415,7 +421,9 @@ class ParametricJob(PRMSet):
print("\tuse './%s' to get results from node disk" % self.cpNodeResultsScriptName(sgeId))
print("\tuse './%s' to clean results from node disk" % self.rmNodeResultsScriptName(sgeId))
print("\tuse './qDel%s.py' to kill your job, get results and clean node disk" % sgeId)
sys.exit()
# to avoid closing the gui
if not (re.match(r'(.+)Gui.pyw', sys.argv[0])):
sys.exit()
def qDelScriptName(self, jobId):
filename = "qDel%s.py"%jobId
......@@ -483,7 +491,8 @@ class ParametricJob(PRMSet):
#file.write("echo 'squeue'\n")
import socket
file.write(". %s %s\n" % (cfgfile, socket.gethostname()))
file.write("srun %s -x -i $SLURM_JOB_ID \n" % (sys.argv[0]))
script = re.sub(r'(.+)Gui.pyw',r'\1.py', sys.argv[0])
file.write("srun %s -x -i $SLURM_JOB_ID \n" % (script))
file.close()
os.chmod(scriptname,0o700)
# send to slurm
......@@ -508,7 +517,10 @@ class ParametricJob(PRMSet):
print("\tuse ' sstat -a --format=JobID,NTasks,MaxRSS,MaxVMSize -j %s ' to get information about your running job (adapt format to your needs)" % slurmId)
print("\tuse ' scancel %s ' to kill your job" % slurmId)
print("\tuse ' sacct --format=JobID,NTasks,NCPUS,CPUTime,Elapsed,MaxRSS,MaxVMSize -j %s ' to get information about your finished job (adapt format to your needs)" % slurmId)
sys.exit()
# to avoid closing the gui
if not (re.match(r'(.+)Gui.pyw', sys.argv[0])):
sys.exit()
def sCancelScriptName(self, jobId):
filename = "sCancel%s.py"%jobId
......@@ -608,7 +620,8 @@ class ParametricJob(PRMSet):
# Lanch the job
import socket
file.write('. %s %s\n' % (cfgfile, socket.gethostname()))
file.write('%s -x -i $PBS_JOBID\n' % (sys.argv[0]))
script = re.sub(r'(.+)Gui.pyw',r'\1.py', sys.argv[0])
file.write('%s -x -i $PBS_JOBID\n' % (script))
file.write('qstat -f $PBS_JOBID\n')
file.close()
os.chmod(scriptname,0o700)
......@@ -648,7 +661,9 @@ class ParametricJob(PRMSet):
print "\tuse ' qdel %s ' to kill your job" % PbsId
#print "\tuse ' sacct --format=JobID,NTasks,NCPUS,CPUTime,Elapsed,MaxRSS,MaxVMSize -j %s ' to get information about your finished job (adapt format to your needs)" % PbsId
'''
sys.exit()
# to avoid closing the gui
if not (re.match(r'(.+)Gui.pyw', sys.argv[0])):
sys.exit()
def PBSCancelScriptName(self, jobId):
filename = "qdel%s.py"%jobId
......
......@@ -148,10 +148,10 @@ class PostProLoop(PRMSet):
if shutil.which(self.pars[key].val):
return True
else:
print "%s is not found (%s)...."%self.pars[key].val
print "\t Check installation and accessibility..."
print "\t Use 'externalProgramPathGui' to define the full program path (recommanded)"
print "\t or add %s in your user path (not recommanded)"%key
print ("%s is not found (%s)...."%self.pars[key].val)
print ("\t Check installation and accessibility...")
print ("\t Use 'externalProgramPathGui' to define the full program path (recommanded)")
print ("\t or add %s in your user path (not recommanded)"%key)
return False
'''
if distutils.spawn.find_executable(os.path.splitext(self.pars[key].val)[0]):
......
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