Revision 583163a6
b/lib/cli.py | ||
---|---|---|
1503 | 1503 |
return utils.SafeEncode(log_msg) |
1504 | 1504 |
|
1505 | 1505 |
|
1506 |
def PollJob(job_id, cl=None, feedback_fn=None, reporter=None): |
|
1506 | 1507 |
"""Function to poll for the result of a job. |
1507 | 1508 |
|
1508 | 1509 |
@type job_id: job identified |
... | ... | |
1515 | 1516 |
if cl is None: |
1516 | 1517 |
cl = GetClient() |
1517 | 1518 |
|
1518 |
if feedback_fn: |
|
1519 |
reporter = FeedbackFnJobPollReportCb(feedback_fn) |
|
1520 |
else: |
|
1521 |
reporter = StdioJobPollReportCb() |
|
1519 |
if reporter is None: |
|
1520 |
if feedback_fn: |
|
1521 |
reporter = FeedbackFnJobPollReportCb(feedback_fn) |
|
1522 |
else: |
|
1523 |
reporter = StdioJobPollReportCb() |
|
1524 |
elif feedback_fn: |
|
1525 |
raise errors.ProgrammerError("Can't specify reporter and feedback function") |
|
1522 | 1526 |
|
1523 | 1527 |
return GenericPollJob(job_id, _LuxiJobPollCb(cl), reporter) |
1524 | 1528 |
|
1525 | 1529 |
|
1526 |
def SubmitOpCode(op, cl=None, feedback_fn=None, opts=None): |
|
1530 |
def SubmitOpCode(op, cl=None, feedback_fn=None, opts=None, reporter=None):
|
|
1527 | 1531 |
"""Legacy function to submit an opcode. |
1528 | 1532 |
|
1529 | 1533 |
This is just a simple wrapper over the construction of the processor |
... | ... | |
1538 | 1542 |
|
1539 | 1543 |
job_id = SendJob([op], cl) |
1540 | 1544 |
|
1541 |
op_results = PollJob(job_id, cl=cl, feedback_fn=feedback_fn) |
|
1545 |
op_results = PollJob(job_id, cl=cl, feedback_fn=feedback_fn, |
|
1546 |
reporter=reporter) |
|
1542 | 1547 |
|
1543 | 1548 |
return op_results[0] |
1544 | 1549 |
|
Also available in: Unified diff