def wait_for_job(job_number)
      authenticate

      # Wait for the job to complete or hit the timeout.
      start = Time.new
      job = repo.job(job_number)
      ilog.start_threaded("Waiting for job #{job_number} to complete.") do |s|
        while !job.finished? && Time.new - start < @timeout
          s.continue("Job status: #{job.state}")
          sleep 10
          job.reload
        end

        if job.finished?
          s.success
        else
          s.failure("Job #{job_number} did not complete within time limit of " \
            "#{@timeout} seconds")
        end
      end
    end
def wait_for_job(job_number)
      authenticate

      # Wait for the job to complete or hit the timeout.
      start = Time.new
      job = repo.job(job_number)
      ilog.start_threaded("Waiting for job #{job_number} to complete.") do |s|
        while !job.finished? && Time.new - start < @timeout
          s.continue("Job status: #{job.state}")
          sleep 10
          job.reload
        end

        if job.finished?
          s.success
        else
          s.failure("Job #{job_number} did not complete within time limit of " \
            "#{@timeout} seconds")
        end
      end
    end
Waits for a job to complete, within the defined timeout.

 @param job_number [String] The job number to wait for.