Revision e2212007
b/lib/cli.py | ||
---|---|---|
369 | 369 |
return answer |
370 | 370 |
|
371 | 371 |
|
372 |
def SubmitOpCode(op, proc=None, feedback_fn=None):
|
|
372 |
def SubmitOpCode(op, cl=None, feedback_fn=None):
|
|
373 | 373 |
"""Legacy function to submit an opcode. |
374 | 374 |
|
375 | 375 |
This is just a simple wrapper over the construction of the processor |
... | ... | |
377 | 377 |
interaction functions. |
378 | 378 |
|
379 | 379 |
""" |
380 |
# TODO: Fix feedback_fn situation.
|
|
381 |
cl = luxi.Client() |
|
380 |
if cl is None:
|
|
381 |
cl = luxi.Client()
|
|
382 | 382 |
|
383 | 383 |
job_id = cl.SubmitJob([op]) |
384 | 384 |
|
... | ... | |
395 | 395 |
break |
396 | 396 |
msg = jobs[0][1] |
397 | 397 |
if msg is not None and msg != lastmsg: |
398 |
print "%s %s" % (time.ctime(msg[0]), msg[2]) |
|
398 |
if callable(feedback_fn): |
|
399 |
feedback_fn(msg) |
|
400 |
else: |
|
401 |
print "%s %s" % (time.ctime(msg[0]), msg[2]) |
|
399 | 402 |
lastmsg = msg |
400 | 403 |
time.sleep(1) |
401 | 404 |
|
b/tools/burnin | ||
---|---|---|
26 | 26 |
import os |
27 | 27 |
import sys |
28 | 28 |
import optparse |
29 |
import time |
|
29 | 30 |
from itertools import izip, islice, cycle |
30 | 31 |
from cStringIO import StringIO |
31 | 32 |
|
... | ... | |
81 | 82 |
|
82 | 83 |
def Feedback(self, msg): |
83 | 84 |
"""Acumulate feedback in our buffer.""" |
84 |
self._feed_buf.write(msg) |
|
85 |
self._feed_buf.write("\n") |
|
85 |
self._feed_buf.write("%s %s\n" % (time.ctime(msg[0]), msg[2])) |
|
86 | 86 |
if self.opts.verbose: |
87 | 87 |
Log(msg) |
88 | 88 |
|
89 | 89 |
def ExecOp(self, op): |
90 | 90 |
"""Execute an opcode and manage the exec buffer.""" |
91 | 91 |
self.ClearFeedbackBuf() |
92 |
return cli.SubmitOpCode(op) |
|
92 |
return cli.SubmitOpCode(op, feedback_fn=self.Feedback)
|
|
93 | 93 |
|
94 | 94 |
def ParseOptions(self): |
95 | 95 |
"""Parses the command line options. |
Also available in: Unified diff