Show More
@@ -231,7 +231,7 b' class BatchEngineSet(object):' | |||
|
231 | 231 | self.template_file = template_file |
|
232 | 232 | self.context = {} |
|
233 | 233 | self.context.update(kwargs) |
|
234 |
self.batch_file = ' |
|
|
234 | self.batch_file = self.template_file+'-run' | |
|
235 | 235 | |
|
236 | 236 | def parse_job_id(self, output): |
|
237 | 237 | m = re.match(self.job_id_regexp, output) |
@@ -240,25 +240,23 b' class BatchEngineSet(object):' | |||
|
240 | 240 | else: |
|
241 | 241 | raise Exception("job id couldn't be determined: %s" % output) |
|
242 | 242 | self.job_id = job_id |
|
243 |
|
|
|
243 | log.msg('Job started with job id: %r' % job_id) | |
|
244 | 244 | return job_id |
|
245 | 245 | |
|
246 | 246 | def write_batch_script(self, n): |
|
247 | print 'n', n | |
|
248 | 247 | self.context['n'] = n |
|
249 | 248 | template = open(self.template_file, 'r').read() |
|
250 | print 'template', template | |
|
251 | log.msg(template) | |
|
249 | log.msg('Using template for batch script: %s' % self.template_file) | |
|
252 | 250 | log.msg(repr(self.context)) |
|
253 | 251 | script_as_string = Itpl.itplns(template, self.context) |
|
254 | log.msg(script_as_string) | |
|
252 | log.msg('Writing instantiated batch script: %s' % self.batch_file) | |
|
255 | 253 | f = open(self.batch_file,'w') |
|
256 | 254 | f.write(script_as_string) |
|
257 | 255 | f.close() |
|
258 | 256 | |
|
259 | 257 | def handle_error(self, f): |
|
260 | 258 | f.printTraceback() |
|
261 |
|
|
|
259 | f.raiseException() | |
|
262 | 260 | |
|
263 | 261 | def start(self, n): |
|
264 | 262 | self.write_batch_script(n) |
@@ -361,6 +359,12 b' def main_pbs(args):' | |||
|
361 | 359 | dstart = cl.start() |
|
362 | 360 | def start_engines(r): |
|
363 | 361 | pbs_set = PBSEngineSet(args.pbsscript) |
|
362 | def shutdown(signum, frame): | |
|
363 | log.msg('Stopping pbs cluster') | |
|
364 | d = pbs_set.kill() | |
|
365 | d.addBoth(lambda _: cl.interrupt_then_kill(1.0)) | |
|
366 | d.addBoth(lambda _: reactor.callLater(2.0, reactor.stop)) | |
|
367 | signal.signal(signal.SIGINT,shutdown) | |
|
364 | 368 | d = pbs_set.start(args.n) |
|
365 | 369 | return d |
|
366 | 370 | dstart.addCallback(start_engines) |
General Comments 0
You need to be logged in to leave comments.
Login now