##// END OF EJS Templates
Initial version that works with PBS.
Brian Granger -
Show More
@@ -248,22 +248,24 b' class BatchEngineSet(object):'
248 self.context['n'] = n
248 self.context['n'] = n
249 template = open(self.template_file, 'r').read()
249 template = open(self.template_file, 'r').read()
250 print 'template', template
250 print 'template', template
251 log.msg(template)
252 log.msg(repr(self.context))
251 script_as_string = Itpl.itplns(template, self.context)
253 script_as_string = Itpl.itplns(template, self.context)
252 print 'script', script_as_string
254 log.msg(script_as_string)
253 f = open(self.batch_file,'w')
255 f = open(self.batch_file,'w')
254 f.write(script_as_string)
256 f.write(script_as_string)
255 f.close()
257 f.close()
256
258
257 def handle_error(self, f):
259 def handle_error(self, f):
258 f.printTraceback()
260 f.printTraceback()
259 f.raiseException()
261 #f.raiseException()
260
262
261 def start(self, n):
263 def start(self, n):
262 self.write_batch_script(n)
264 self.write_batch_script(n)
263 d = getProcessOutput(self.submit_command,
265 d = getProcessOutput(self.submit_command,
264 [self.batch_file],env=os.environ)
266 [self.batch_file],env=os.environ)
265 d.addCallback(self.parse_job_id)
267 d.addCallback(self.parse_job_id)
266 #d.addErrback(self.handle_error)
268 d.addErrback(self.handle_error)
267 return d
269 return d
268
270
269 def kill(self):
271 def kill(self):
@@ -349,15 +351,20 b' def main_mpirun(args):'
349 dstart.addErrback(lambda f: f.raiseException())
351 dstart.addErrback(lambda f: f.raiseException())
350
352
351 def main_pbs(args):
353 def main_pbs(args):
352 cl = ControllerLauncher()
354 cont_args = []
355 cont_args.append('--logfile=%s' % pjoin(args.logdir,'ipcontroller'))
356 if args.x:
357 cont_args.append('-x')
358 if args.y:
359 cont_args.append('-y')
360 cl = ControllerLauncher(extra_args=cont_args)
353 dstart = cl.start()
361 dstart = cl.start()
354 def start_engines(r):
362 def start_engines(r):
355 pbs_set = PBSEngineSet('pbs.template')
363 pbs_set = PBSEngineSet(args.pbsscript)
356 print pbs_set.template_file
357 d = pbs_set.start(args.n)
364 d = pbs_set.start(args.n)
358 return d
365 return d
359 dstart.addCallback(start_engines)
366 dstart.addCallback(start_engines)
360 dstart.addErrback(lambda f: f.printTraceback())
367 dstart.addErrback(lambda f: f.raiseException())
361
368
362
369
363 def get_args():
370 def get_args():
@@ -418,9 +425,18 b' def get_args():'
418 )
425 )
419 parser_mpirun.set_defaults(func=main_mpirun)
426 parser_mpirun.set_defaults(func=main_mpirun)
420
427
421 parser_pbs = subparsers.add_parser('pbs', help='run a pbs cluster')
428 parser_pbs = subparsers.add_parser(
422 parser_pbs.add_argument('--pbs-script', type=str, dest='pbsscript',
429 'pbs',
423 help='PBS script template')
430 help='run a pbs cluster',
431 parents=[base_parser]
432 )
433 parser_pbs.add_argument(
434 '--pbs-script',
435 type=str,
436 dest='pbsscript',
437 help='PBS script template',
438 default='pbs.template'
439 )
424 parser_pbs.set_defaults(func=main_pbs)
440 parser_pbs.set_defaults(func=main_pbs)
425 args = parser.parse_args()
441 args = parser.parse_args()
426 return args
442 return args
General Comments 0
You need to be logged in to leave comments. Login now