Revision 793a8f7c lib/luxi.py

b/lib/luxi.py
64 64
DEF_CTMO = 10
65 65
DEF_RWTO = 60
66 66

  
67
# WaitForJobChange timeout
68
WFJC_TIMEOUT = (DEF_RWTO - 1) / 2
69

  
67 70

  
68 71
class ProtocolError(Exception):
69 72
  """Denotes an error in the server communication"""
......
373 376
    return self.CallMethod(REQ_AUTOARCHIVE_JOBS, (age, timeout))
374 377

  
375 378
  def WaitForJobChangeOnce(self, job_id, fields,
376
                           prev_job_info, prev_log_serial):
377
    timeout = (DEF_RWTO - 1) / 2
379
                           prev_job_info, prev_log_serial,
380
                           timeout=WFJC_TIMEOUT):
381
    """Waits for changes on a job.
382

  
383
    @param job_id: Job ID
384
    @type fields: list
385
    @param fields: List of field names to be observed
386
    @type prev_job_info: None or list
387
    @param prev_job_info: Previously received job information
388
    @type prev_log_serial: None or int/long
389
    @param prev_log_serial: Highest log serial number previously received
390
    @type timeout: int/float
391
    @param timeout: Timeout in seconds (values larger than L{WFJC_TIMEOUT} will
392
                    be capped to that value)
393

  
394
    """
395
    assert timeout >= 0, "Timeout can not be negative"
378 396
    return self.CallMethod(REQ_WAIT_FOR_JOB_CHANGE,
379 397
                           (job_id, fields, prev_job_info,
380
                            prev_log_serial, timeout))
398
                            prev_log_serial,
399
                            min(WFJC_TIMEOUT, timeout)))
381 400

  
382 401
  def WaitForJobChange(self, job_id, fields, prev_job_info, prev_log_serial):
383 402
    while True:

Also available in: Unified diff