def WatchJob(opts, args):
  job_id = args[0]

  msg = ("Output from job %s follows" % job_id)
  ToStdout(msg)
  ToStdout("-" * len(msg))

  retcode = 0
  try:
    cli.PollJob(job_id)
  except errors.GenericError, err:
    (retcode, job_result) = cli.FormatError(err)
    ToStderr("Job %s failed: %s", job_id, job_result)

  return retcode
Follow a job and print its output as it arrives.
dataset/ETHPy150Open ganeti/ganeti/lib/client/gnt_job.py/WatchJob