diff options
author | Clark Williams <williams@redhat.com> | 2012-01-09 16:48:51 -0600 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2012-01-09 16:48:51 -0600 |
commit | c9c862c407a27946931ca8f60f9a3a733f364d74 (patch) | |
tree | 228cd2577751dd944e613f7b3d984483ef06c92f | |
parent | 5dcd4102492f115b9425734ec77cb59f3c045b89 (diff) | |
download | rteval-c9c862c407a27946931ca8f60f9a3a733f364d74.tar.gz rteval-c9c862c407a27946931ca8f60f9a3a733f364d74.tar.xz rteval-c9c862c407a27946931ca8f60f9a3a733f364d74.zip |
start hackbench with helper function
Use a helper so we get a report when hackbench restarts
Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r-- | rteval/hackbench.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/rteval/hackbench.py b/rteval/hackbench.py index 42a6ca7..4a112dd 100644 --- a/rteval/hackbench.py +++ b/rteval/hackbench.py @@ -73,6 +73,10 @@ class Hackbench(load.Load): def build(self): self.ready = True + def start_hackbench(self, inf, outf, errf): + self.debug("running: %s" % " ".join(self.args)) + return subprocess.Popen(self.args, stdin=inf, stdout=outf, stderr=errf) + def runload(self): # if we don't have any jobs just wait for the stop event and return if self.jobs == 0: @@ -86,12 +90,13 @@ class Hackbench(load.Load): out = err = null self.debug("starting loop (jobs: %d)" % self.jobs) + p = self.start_hackbench(null, out, err) while not self.stopevent.isSet(): try: - p = subprocess.Popen(self.args, stdin=out, stdout=out, stderr=err) - time.sleep(1.0) + # if poll() returns an exit status, restart if p.poll() != None: - p.wait() + p = self.start_hackbench(null, out, err) + time.sleep(1.0) except OSError, e: if e.errno != errno.ENOMEM: raise |