Revision 7f97eb93 lib/luxi.py
b/lib/luxi.py | ||
---|---|---|
1 | 1 |
# |
2 | 2 |
# |
3 | 3 |
|
4 |
# Copyright (C) 2006, 2007, 2011, 2012 Google Inc. |
|
4 |
# Copyright (C) 2006, 2007, 2011, 2012, 2014 Google Inc.
|
|
5 | 5 |
# |
6 | 6 |
# This program is free software; you can redistribute it and/or modify |
7 | 7 |
# it under the terms of the GNU General Public License as published by |
... | ... | |
487 | 487 |
jobs_state.append([op.__getstate__() for op in ops]) |
488 | 488 |
return self.CallMethod(REQ_SUBMIT_MANY_JOBS, (jobs_state, )) |
489 | 489 |
|
490 |
@staticmethod |
|
491 |
def _PrepareJobId(request_name, job_id): |
|
492 |
try: |
|
493 |
return int(job_id) |
|
494 |
except ValueError: |
|
495 |
raise RequestError("Invalid parameter passed to %s as job id: " |
|
496 |
" expected integer, got value %s" % |
|
497 |
(request_name, job_id)) |
|
498 |
|
|
490 | 499 |
def CancelJob(self, job_id): |
500 |
job_id = Client._PrepareJobId(REQ_CANCEL_JOB, job_id) |
|
491 | 501 |
return self.CallMethod(REQ_CANCEL_JOB, (job_id, )) |
492 | 502 |
|
493 | 503 |
def ArchiveJob(self, job_id): |
504 |
job_id = Client._PrepareJobId(REQ_ARCHIVE_JOB, job_id) |
|
494 | 505 |
return self.CallMethod(REQ_ARCHIVE_JOB, (job_id, )) |
495 | 506 |
|
496 | 507 |
def ChangeJobPriority(self, job_id, priority): |
508 |
job_id = Client._PrepareJobId(REQ_CHANGE_JOB_PRIORITY, job_id) |
|
497 | 509 |
return self.CallMethod(REQ_CHANGE_JOB_PRIORITY, (job_id, priority)) |
498 | 510 |
|
499 | 511 |
def AutoArchiveJobs(self, age): |
... | ... | |
524 | 536 |
min(WFJC_TIMEOUT, timeout))) |
525 | 537 |
|
526 | 538 |
def WaitForJobChange(self, job_id, fields, prev_job_info, prev_log_serial): |
539 |
job_id = Client._PrepareJobId(REQ_WAIT_FOR_JOB_CHANGE, job_id) |
|
527 | 540 |
while True: |
528 | 541 |
result = self.WaitForJobChangeOnce(job_id, fields, |
529 | 542 |
prev_job_info, prev_log_serial) |
Also available in: Unified diff