2010/5/11 Iustin Pop <ius...@google.com>: > On Mon, May 10, 2010 at 05:30:36PM +0200, Michael Hanselmann wrote: >> --- a/lib/luxi.py >> +++ b/lib/luxi.py >> return self.CallMethod(REQ_AUTOARCHIVE_JOBS, (age, timeout)) >> >> def WaitForJobChangeOnce(self, job_id, fields, >> - prev_job_info, prev_log_serial): >> - timeout = (DEF_RWTO - 1) / 2 >> + prev_job_info, prev_log_serial, >> + timeout=WFJC_TIMEOUT): > > Please document that if the passed value is bigger than WFJC_TIMEOUT, > it's ignored/reset to WFJC_TIMEOUT.
Interdiff: --- a/lib/luxi.py +++ b/lib/luxi.py @@ -378,6 +378,20 @@ class Client(object): def WaitForJobChangeOnce(self, job_id, fields, prev_job_info, prev_log_serial, timeout=WFJC_TIMEOUT): + """Waits for changes on a job. + + @param job_id: Job ID + @type fields: list + @param fields: List of field names to be observed + @type prev_job_info: None or list + @param prev_job_info: Previously received job information + @type prev_log_serial: None or int/long + @param prev_log_serial: Highest log serial number previously received + @type timeout: int/float + @param timeout: Timeout in seconds (values larger than L{WFJC_TIMEOUT} will + be ignored) + + """ assert timeout >= 0, "Timeout can not be negative" return self.CallMethod(REQ_WAIT_FOR_JOB_CHANGE, (job_id, fields, prev_job_info, >> --- a/lib/rapi/rlib2.py >> +++ b/lib/rapi/rlib2.py >> +# Timeout for /2/jobs/[job_id]/wait. Gives job up to 10 seconds to change. >> +_WFJC_TIMEOUT = 10 > > Hmm, why is this not luxi.WFJC_TIMEOUT? luxi.WFJC_TIMEOUT is 29 seconds by default. That seemend quite long for HTTP requests (client timeouts, etc.). It shouldn't be too low either (otherwise it's like polling). Michael