Currently, the feedback_fn argument to SubmitOpCode is no longer used.
We still need it in burnin, so we re-enable it by making the code call
that function with the msg argument in case feedback_fn is callable. The
patch also modifies burnin to accept the new argument format (msg is not
a triple instead of a string).
The patch also removes the ‘proc’ argument as it's obsolete; instead we
can accept a luxi.Client instance (noone uses this right now).
Reviewed-by: ultrotter
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
interaction functions.
"""
- # TODO: Fix feedback_fn situation.
- cl = luxi.Client()
+ if cl is None:
+ cl = luxi.Client()
job_id = cl.SubmitJob([op])
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)
import os
import sys
import optparse
+import time
from itertools import izip, islice, cycle
from cStringIO import StringIO
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.