Example #1
0
        /// <inheritdoc />
        public override BigqueryJob PollJob(JobReference jobReference, PollJobOptions options = null)
        {
            GaxRestPreconditions.CheckNotNull(jobReference, nameof(jobReference));
            options?.Validate();

            DateTimeOffset?deadline    = options?.GetEffectiveDeadline() ?? DateTimeOffset.MaxValue;
            long           maxRequests = options?.MaxRequests ?? long.MaxValue;
            TimeSpan       interval    = options?.Interval ?? TimeSpan.FromSeconds(1);

            for (long i = 0; i < maxRequests && DateTimeOffset.UtcNow < deadline; i++)
            {
                var job = GetJob(jobReference);
                if (job.State == JobState.Done)
                {
                    return(job);
                }
                Thread.Sleep(interval);
            }
            throw new TimeoutException($"Job {jobReference.JobId} did not complete in time.");
        }
Example #2
0
 /// <summary>
 /// Polls the specified job for completion.
 /// </summary>
 /// <param name="jobReference">A fully-qualified identifier for the job. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The completed job.</returns>
 public virtual BigqueryJob PollJob(JobReference jobReference, PollJobOptions options = null)
 {
     throw new NotImplementedException();
 }
Example #3
0
 /// <summary>
 /// Polls the job with the specified project ID and job ID.
 /// This method just creates a <see cref="JobReference"/> and delegates to <see cref="PollJob(JobReference,PollJobOptions)"/>.
 /// </summary>
 /// <param name="projectId">The project ID. Must not be null.</param>
 /// <param name="jobId">The job ID. Must not be null.</param>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The completed job.</returns>
 public virtual BigqueryJob PollJob(string projectId, string jobId, PollJobOptions options = null) =>
 PollJob(GetJobReference(projectId, jobId), options);
 /// <summary>
 /// Polls this job for completion.
 /// </summary>
 /// <param name="options">The options for the operation. May be null, in which case defaults will be supplied.</param>
 /// <returns>The completed job.</returns>
 public BigqueryJob Poll(PollJobOptions options = null) => _client.PollJob(Reference, options);