Commit 44d52bca authored by lejeune's avatar lejeune
Browse files

reshape pbs launcher

parent 7c86d660
......@@ -199,10 +199,7 @@ def launch_ssh(pipe, host_list, address=None, authkey='secret',log_level=logging
w.wait()
def launch_pbs(pipe, n, address=None, authkey='secret', job_name="job_", log_level=logging.WARNING, cpu_time="2:00:00", server=False, job_header="""
#/bin/bash
echo $PYTHONPATH
""" ):
def launch_pbs(pipe, n, address=None, authkey='secret', job_name="job_", log_level=logging.WARNING, cpu_time="2:00:00", server=False, job_header="",ppn=1 ):
""" Launch a bunch of distant workers through a PBS batch system.
"""
......@@ -213,17 +210,19 @@ echo $PYTHONPATH
mgr = SchedulerManager(address=address, authkey=authkey)
mgr.start()
processlist = []
job_header0="#PBS -S /bin/bash"
for i in range(n):
jobfile = get_log_file (pipe, 'job%d'%i)
errfile = jobfile.replace('job', 'err')
logfile = jobfile.replace('job', 'log')
f = file(jobfile, 'w')
f.write (job_header+"\n")
f.write (job_header0+"\n")
f.write ("#PBS -o %s\n"%logfile)
f.write ("#PBS -e %s\n"%errfile)
f.write ("#PBS -N %s%d\n"%(job_name,i))
f.write ("#PBS -l select=1:ncpus=1,walltime=%s\n"%cpu_time)
f.write ("#PBS -l nodes=1:ppn=%d,walltime=%s\n"%(cpu_time, ppn))
f.write (job_header+"\n")
f.write ("python -m pipelet.launchers -H %s -p %s -s %s -l %s"%(address[0],address[1],authkey,jobfile.replace('job','worker')))
f.close()
subprocess.Popen(['qsub','-o' ,logfile, '-e', errfile,jobfile]).communicate()[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