Revision f4484122
b/lib/cli.py | ||
---|---|---|
1132 | 1132 |
prev_job_info = None |
1133 | 1133 |
prev_logmsg_serial = None |
1134 | 1134 |
|
1135 |
status = None |
|
1136 |
|
|
1137 |
notified_queued = False |
|
1138 |
notified_waitlock = False |
|
1139 |
|
|
1135 | 1140 |
while True: |
1136 |
result = cl.WaitForJobChange(job_id, ["status"], prev_job_info, |
|
1137 |
prev_logmsg_serial) |
|
1141 |
result = cl.WaitForJobChangeOnce(job_id, ["status"], prev_job_info,
|
|
1142 |
prev_logmsg_serial)
|
|
1138 | 1143 |
if not result: |
1139 | 1144 |
# job not found, go away! |
1140 | 1145 |
raise errors.JobLost("Job with id %s lost" % job_id) |
1146 |
elif result == constants.JOB_NOTCHANGED: |
|
1147 |
if status is not None and not callable(feedback_fn): |
|
1148 |
if status == constants.JOB_STATUS_QUEUED and not notified_queued: |
|
1149 |
ToStderr("Job %s is waiting in queue", job_id) |
|
1150 |
notified_queued = True |
|
1151 |
elif status == constants.JOB_STATUS_WAITLOCK and not notified_waitlock: |
|
1152 |
ToStderr("Job %s is trying to acquire all necessary locks", job_id) |
|
1153 |
notified_waitlock = True |
|
1154 |
|
|
1155 |
# Wait again |
|
1156 |
continue |
|
1141 | 1157 |
|
1142 | 1158 |
# Split result, a tuple of (field values, log entries) |
1143 | 1159 |
(job_info, log_entries) = result |
b/lib/luxi.py | ||
---|---|---|
372 | 372 |
timeout = (DEF_RWTO - 1) / 2 |
373 | 373 |
return self.CallMethod(REQ_AUTOARCHIVE_JOBS, (age, timeout)) |
374 | 374 |
|
375 |
def WaitForJobChange(self, job_id, fields, prev_job_info, prev_log_serial): |
|
375 |
def WaitForJobChangeOnce(self, job_id, fields, |
|
376 |
prev_job_info, prev_log_serial): |
|
376 | 377 |
timeout = (DEF_RWTO - 1) / 2 |
378 |
return self.CallMethod(REQ_WAIT_FOR_JOB_CHANGE, |
|
379 |
(job_id, fields, prev_job_info, |
|
380 |
prev_log_serial, timeout)) |
|
381 |
|
|
382 |
def WaitForJobChange(self, job_id, fields, prev_job_info, prev_log_serial): |
|
377 | 383 |
while True: |
378 |
result = self.CallMethod(REQ_WAIT_FOR_JOB_CHANGE, |
|
379 |
(job_id, fields, prev_job_info, |
|
380 |
prev_log_serial, timeout)) |
|
384 |
result = self.WaitForJobChangeOnce(job_id, fields, |
|
385 |
prev_job_info, prev_log_serial) |
|
381 | 386 |
if result != constants.JOB_NOTCHANGED: |
382 | 387 |
break |
383 | 388 |
return result |
... | ... | |
402 | 407 |
|
403 | 408 |
def QueryTags(self, kind, name): |
404 | 409 |
return self.CallMethod(REQ_QUERY_TAGS, (kind, name)) |
405 |
|
|
406 |
|
|
407 |
# TODO: class Server(object) |
Also available in: Unified diff