Show More
@@ -248,22 +248,24 b' class BatchEngineSet(object):' | |||
|
248 | 248 | self.context['n'] = n |
|
249 | 249 | template = open(self.template_file, 'r').read() |
|
250 | 250 | print 'template', template |
|
251 | log.msg(template) | |
|
252 | log.msg(repr(self.context)) | |
|
251 | 253 | script_as_string = Itpl.itplns(template, self.context) |
|
252 |
|
|
|
254 | log.msg(script_as_string) | |
|
253 | 255 | f = open(self.batch_file,'w') |
|
254 | 256 | f.write(script_as_string) |
|
255 | 257 | f.close() |
|
256 | 258 | |
|
257 | 259 | def handle_error(self, f): |
|
258 | 260 | f.printTraceback() |
|
259 | f.raiseException() | |
|
261 | #f.raiseException() | |
|
260 | 262 | |
|
261 | 263 | def start(self, n): |
|
262 | 264 | self.write_batch_script(n) |
|
263 | 265 | d = getProcessOutput(self.submit_command, |
|
264 | 266 | [self.batch_file],env=os.environ) |
|
265 | 267 | d.addCallback(self.parse_job_id) |
|
266 |
|
|
|
268 | d.addErrback(self.handle_error) | |
|
267 | 269 | return d |
|
268 | 270 | |
|
269 | 271 | def kill(self): |
@@ -349,15 +351,20 b' def main_mpirun(args):' | |||
|
349 | 351 | dstart.addErrback(lambda f: f.raiseException()) |
|
350 | 352 | |
|
351 | 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 | 361 | dstart = cl.start() |
|
354 | 362 | def start_engines(r): |
|
355 |
pbs_set = PBSEngineSet( |
|
|
356 | print pbs_set.template_file | |
|
363 | pbs_set = PBSEngineSet(args.pbsscript) | |
|
357 | 364 | d = pbs_set.start(args.n) |
|
358 | 365 | return d |
|
359 | 366 | dstart.addCallback(start_engines) |
|
360 |
dstart.addErrback(lambda f: f. |
|
|
367 | dstart.addErrback(lambda f: f.raiseException()) | |
|
361 | 368 | |
|
362 | 369 | |
|
363 | 370 | def get_args(): |
@@ -418,9 +425,18 b' def get_args():' | |||
|
418 | 425 | ) |
|
419 | 426 | parser_mpirun.set_defaults(func=main_mpirun) |
|
420 | 427 | |
|
421 |
parser_pbs = subparsers.add_parser( |
|
|
422 | parser_pbs.add_argument('--pbs-script', type=str, dest='pbsscript', | |
|
423 | help='PBS script template') | |
|
428 | parser_pbs = subparsers.add_parser( | |
|
429 | 'pbs', | |
|
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 | 440 | parser_pbs.set_defaults(func=main_pbs) |
|
425 | 441 | args = parser.parse_args() |
|
426 | 442 | return args |
General Comments 0
You need to be logged in to leave comments.
Login now