diff --git a/lib/cli.py b/lib/cli.py index 34a2bfbeb385f7f97cc54805c5dc6f4e1aa52a4e..1eab65649f0b024c2823c1224d95fd7f005c1b11 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -369,7 +369,7 @@ def AskUser(text, choices=None): return answer -def SubmitOpCode(op, proc=None, feedback_fn=None): +def SubmitOpCode(op, cl=None, feedback_fn=None): """Legacy function to submit an opcode. This is just a simple wrapper over the construction of the processor @@ -377,8 +377,8 @@ def SubmitOpCode(op, proc=None, feedback_fn=None): interaction functions. """ - # TODO: Fix feedback_fn situation. - cl = luxi.Client() + if cl is None: + cl = luxi.Client() job_id = cl.SubmitJob([op]) @@ -395,7 +395,10 @@ def SubmitOpCode(op, proc=None, feedback_fn=None): break msg = jobs[0][1] if msg is not None and msg != lastmsg: - print "%s %s" % (time.ctime(msg[0]), msg[2]) + if callable(feedback_fn): + feedback_fn(msg) + else: + print "%s %s" % (time.ctime(msg[0]), msg[2]) lastmsg = msg time.sleep(1) diff --git a/tools/burnin b/tools/burnin index 339a7e29349290ba33de73c515daff26212d80a6..cfa848aec7d484ea2b49355367610978d9cae4c9 100755 --- a/tools/burnin +++ b/tools/burnin @@ -26,6 +26,7 @@ import os import sys import optparse +import time from itertools import izip, islice, cycle from cStringIO import StringIO @@ -81,15 +82,14 @@ class Burner(object): def Feedback(self, msg): """Acumulate feedback in our buffer.""" - self._feed_buf.write(msg) - self._feed_buf.write("\n") + self._feed_buf.write("%s %s\n" % (time.ctime(msg[0]), msg[2])) if self.opts.verbose: Log(msg) def ExecOp(self, op): """Execute an opcode and manage the exec buffer.""" self.ClearFeedbackBuf() - return cli.SubmitOpCode(op) + return cli.SubmitOpCode(op, feedback_fn=self.Feedback) def ParseOptions(self): """Parses the command line options.