/** Example of reloading all fields until job status is DONE. */ // [TARGET reload(JobOption...)] public JobStatus.State reload() throws InterruptedException { // [START ] while (!JobStatus.State.DONE.equals(job.getStatus().getState())) { Thread.sleep(1000L); job = job.reload(); } // [END ] return job.getStatus().getState(); }
if (job.getStatus() == null || !JobStatus.State.DONE.equals(job.getStatus().getState())) { job = reload();
/** Example of reloading status field until job status is DONE. */ // [TARGET reload(JobOption...)] public JobStatus.State reloadStatus() throws InterruptedException { // [START ] while (!JobStatus.State.DONE.equals(job.getStatus().getState())) { Thread.sleep(1000L); job = job.reload(BigQuery.JobOption.fields(BigQuery.JobField.STATUS)); } // [END ] return job.getStatus().getState(); }
if (job.getStatus() == null || !JobStatus.State.DONE.equals(job.getStatus().getState())) { job = reload();
/** * Checks if this job has completed its execution, either failing or succeeding. If the job does * not exist this method returns {@code true}. * * <p>Example of waiting for a job until it reports that it is done. * * <pre>{@code * while (!job.isDone()) { * Thread.sleep(1000L); * } * }</pre> * * @return {@code true} if this job is in {@link JobStatus.State#DONE} state or if it does not * exist, {@code false} if the state is not {@link JobStatus.State#DONE} * @throws BigQueryException upon failure */ public boolean isDone() { checkNotDryRun("isDone"); Job job = bigquery.getJob(getJobId(), JobOption.fields(BigQuery.JobField.STATUS)); return job == null || JobStatus.State.DONE.equals(job.getStatus().getState()); } /**
@Override public boolean shouldRetry(Throwable prevThrowable, Job prevResponse) { return prevResponse != null && !JobStatus.State.DONE.equals(prevResponse.getStatus().getState()); } },
/** * Checks if this job has completed its execution, either failing or succeeding. If the job does * not exist this method returns {@code true}. * * <p>Example of waiting for a job until it reports that it is done. * * <pre>{@code * while (!job.isDone()) { * Thread.sleep(1000L); * } * }</pre> * * @return {@code true} if this job is in {@link JobStatus.State#DONE} state or if it does not * exist, {@code false} if the state is not {@link JobStatus.State#DONE} * @throws BigQueryException upon failure */ public boolean isDone() { checkNotDryRun("isDone"); Job job = bigquery.getJob(getJobId(), JobOption.fields(BigQuery.JobField.STATUS)); return job == null || JobStatus.State.DONE.equals(job.getStatus().getState()); } /**
@Override public boolean shouldRetry(Throwable prevThrowable, Job prevResponse) { return prevResponse != null && !JobStatus.State.DONE.equals(prevResponse.getStatus().getState()); } },