Revision 0a1e74d9 lib/cli.py

b/lib/cli.py
369 369
  return answer
370 370

  
371 371

  
372
def SubmitOpCode(op, cl=None, feedback_fn=None):
373
  """Legacy function to submit an opcode.
372
def SendJob(ops, cl=None):
373
  """Function to submit an opcode without waiting for the results.
374 374

  
375
  This is just a simple wrapper over the construction of the processor
376
  instance. It should be extended to better handle feedback and
377
  interaction functions.
375
  @type ops: list
376
  @param ops: list of opcodes
377
  @type cl: luxi.Client
378
  @param cl: the luxi client to use for communicating with the master;
379
             if None, a new client will be created
378 380

  
379 381
  """
380 382
  if cl is None:
381 383
    cl = GetClient()
382 384

  
383
  job_id = cl.SubmitJob([op])
385
  job_id = cl.SubmitJob(ops)
386

  
387
  return job_id
388

  
389

  
390
def PollJob(job_id, cl=None):
391
  """Function to poll for the result of a job.
392

  
393
  @type job_id: job identified
394
  @param job_id: the job to poll for results
395
  @type cl: luxi.Client
396
  @param cl: the luxi client to use for communicating with the master;
397
             if None, a new client will be created
398

  
399
  """
400
  if cl is None:
401
    cl = GetClient()
384 402

  
385 403
  lastmsg = None
386 404
  while True:
......
413 431
    raise errors.OpExecError(result)
414 432

  
415 433

  
434
def SubmitOpCode(op, cl=None, feedback_fn=None):
435
  """Legacy function to submit an opcode.
436

  
437
  This is just a simple wrapper over the construction of the processor
438
  instance. It should be extended to better handle feedback and
439
  interaction functions.
440

  
441
  """
442
  if cl is None:
443
    cl = GetClient()
444

  
445
  job_id = SendJob([op], cl)
446

  
447
  return PollJob(job_id, cl)
448

  
449

  
416 450
def GetClient():
417 451
  # TODO: Cache object?
418 452
  try:

Also available in: Unified diff