Skip to content

Commit

Permalink
writes a script in ./.moa/tmp now - easier to track
Browse files Browse the repository at this point in the history
  • Loading branch information
mfiers committed May 28, 2012
1 parent 42fe74b commit 3bdfd69
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions lib/python/moa/plugin/system/openLavaActor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
import sys
import time
import tempfile
import optparse
import subprocess as sp

Expand Down Expand Up @@ -74,14 +75,17 @@ def s(*cl):
s("#BSUB -q", sysConf.args.openlavaQueue)


slots = sysConf.job.conf.get('threads', sysConf.args.openlavaSlots)
if '--oln' in sys.argv:
slots = sysConf.args.openlavaSlots
else:
slots = sysConf.job.conf.get('threads', sysConf.args.openlavaSlots)

s("#BSUB -n", slots)

lastJids = []

#if len(sysConf.job.data.openlava.get('jidlist', [])) > 1:
# lastJids = sysConf.job.data.openlava.get('jidlist')[-1]


if command == 'run':
prep_jids = sysConf.job.data.openlava.jids.get('prepare', [])
Expand Down Expand Up @@ -132,9 +136,20 @@ def s(*cl):
s("")
s(*(['/bin/bash'] + cl))

#save the file
tmpdir = os.path.join(wd, '.moa', 'tmp')
if not os.path.exists(tmpdir):
os.makedirs(tmpdir)

tmpfile = tempfile.NamedTemporaryFile(dir=tmpdir, prefix='openlava.',
delete=False, suffix='.sh')
tmpfile.write("\n".join(sc))
tmpfilename = tmpfile.name
tmpfile.close()

l.debug("executing bsub")
moa.ui.message("Submitting job to openlava")
p = sp.Popen('bsub', cwd = wd, stdout=sp.PIPE, stdin=sp.PIPE)
p = sp.Popen(['bsub', tmpfilename], cwd = wd, stdout=sp.PIPE, stdin=sp.PIPE)
o,e = p.communicate("\n".join(sc))

jid = int(o.split("<")[1].split(">")[0])
Expand Down

0 comments on commit 3bdfd69

Please sign in to comment.