440 |
440 |
return retcode
|
441 |
441 |
|
442 |
442 |
|
|
443 |
def WaitJob(opts, args):
|
|
444 |
"""Wait for a job to finish, not producing any output.
|
|
445 |
|
|
446 |
@param opts: the command line options selected by the user
|
|
447 |
@type args: list
|
|
448 |
@param args: Contains the job ID
|
|
449 |
@rtype: int
|
|
450 |
@return: the desired exit code
|
|
451 |
|
|
452 |
"""
|
|
453 |
job_id = args[0]
|
|
454 |
|
|
455 |
retcode = 0
|
|
456 |
try:
|
|
457 |
cli.PollJob(job_id, feedback_fn=lambda _: None)
|
|
458 |
except errors.GenericError, err:
|
|
459 |
(retcode, job_result) = cli.FormatError(err)
|
|
460 |
ToStderr("Job %s failed: %s", job_id, job_result)
|
|
461 |
|
|
462 |
return retcode
|
|
463 |
|
|
464 |
|
443 |
465 |
_PENDING_OPT = \
|
444 |
466 |
cli_option("--pending", default=None,
|
445 |
467 |
action="store_const", dest="status_filter",
|
... | ... | |
523 |
545 |
ShowJobs, [ArgJobId(min=1)], [],
|
524 |
546 |
"<job-id> [<job-id> ...]",
|
525 |
547 |
"Show detailed information about the specified jobs"),
|
|
548 |
"wait": (
|
|
549 |
WaitJob, [ArgJobId(min=1, max=1)], [],
|
|
550 |
"<job-id>", "Wait for a job to finish"),
|
526 |
551 |
"watch": (
|
527 |
552 |
WatchJob, [ArgJobId(min=1, max=1)], [],
|
528 |
553 |
"<job-id>", "Follows a job and prints its output as it arrives"),
|