本文整理了Java中com.google.api.services.bigquery.model.Job.setStatus()
方法的一些代码示例,展示了Job.setStatus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.setStatus()
方法的具体详情如下:
包路径:com.google.api.services.bigquery.model.Job
类名称:Job
方法名:setStatus
[英][Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
[中][仅输出]此作业的状态。在轮询异步作业以查看作业是否完成时,请检查此值。
代码示例来源:origin: googleapis/google-cloud-java
Job toPb() {
Job jobPb = new Job();
jobPb.setEtag(etag);
jobPb.setId(generatedId);
jobPb.setSelfLink(selfLink);
jobPb.setUserEmail(userEmail);
if (jobId != null) {
jobPb.setJobReference(jobId.toPb());
}
if (status != null) {
jobPb.setStatus(status.toPb());
}
if (statistics != null) {
jobPb.setStatistics(statistics.toPb());
}
if (configuration != null) {
jobPb.setConfiguration(configuration.toPb());
}
return jobPb;
}
代码示例来源:origin: googleapis/google-cloud-java
.setJobReference(queryJob.toPb())
.setId(JOB)
.setStatus(new com.google.api.services.bigquery.model.JobStatus().setState("DONE"));
jobResponsePb.getConfiguration().getQuery().setDestinationTable(TABLE_ID.toPb());
GetQueryResultsResponse responsePb =
代码示例来源:origin: googleapis/google-cloud-java
.setJobReference(queryJob.toPb())
.setId(JOB)
.setStatus(new com.google.api.services.bigquery.model.JobStatus().setState("DONE"));
jobResponsePb.getConfiguration().getQuery().setDestinationTable(TABLE_ID.toPb());
GetQueryResultsResponse responsePb =
代码示例来源:origin: googleapis/google-cloud-java
@Override
public Job apply(JobList.Jobs jobPb) {
JobStatus statusPb =
jobPb.getStatus() != null ? jobPb.getStatus() : new JobStatus();
if (statusPb.getState() == null) {
statusPb.setState(jobPb.getState());
}
if (statusPb.getErrorResult() == null) {
statusPb.setErrorResult(jobPb.getErrorResult());
}
return new Job()
.setConfiguration(jobPb.getConfiguration())
.setId(jobPb.getId())
.setJobReference(jobPb.getJobReference())
.setKind(jobPb.getKind())
.setStatistics(jobPb.getStatistics())
.setStatus(statusPb)
.setUserEmail(jobPb.getUserEmail());
}
}));
代码示例来源:origin: stackoverflow.com
@HandleAfterCreate
public void addNewRemoteJob(Job job) {
remoteJobDispatcher.sendRequest(job);
remoteJobDispatcher.waitForTheResult(job);
}
class RemoteJobDispatcher {
@Async
public void waitForTheResult(Job job) {
while(true) {
status = askRemoteServerForJobStatus(job)
if (status != IN_PROGRESS) {
job.setStatus(status);
jobRepository.save(job);
return;
}
sleep(2000);
}
}
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
@Test
public void testGetJobSucceeds() throws Exception {
Job testJob = new Job();
testJob.setStatus(new JobStatus());
when(response.getContentType()).thenReturn(Json.MEDIA_TYPE);
when(response.getStatusCode()).thenReturn(200);
when(response.getContent()).thenReturn(toStream(testJob));
BigQueryServicesImpl.JobServiceImpl jobService =
new BigQueryServicesImpl.JobServiceImpl(bigquery);
JobReference jobRef = new JobReference().setProjectId("projectId").setJobId("jobId");
Job job = jobService.getJob(jobRef, Sleeper.DEFAULT, BackOff.ZERO_BACKOFF);
assertEquals(testJob, job);
verify(response, times(1)).getStatusCode();
verify(response, times(1)).getContent();
verify(response, times(1)).getContentType();
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
/** Tests that {@link BigQueryServicesImpl.JobServiceImpl#pollJob} returns UNKNOWN. */
@Test
public void testPollJobUnknown() throws IOException, InterruptedException {
Job testJob = new Job();
testJob.setStatus(new JobStatus());
when(response.getContentType()).thenReturn(Json.MEDIA_TYPE);
when(response.getStatusCode()).thenReturn(200);
when(response.getContent()).thenReturn(toStream(testJob));
BigQueryServicesImpl.JobServiceImpl jobService =
new BigQueryServicesImpl.JobServiceImpl(bigquery);
JobReference jobRef = new JobReference().setProjectId("projectId").setJobId("jobId");
Job job = jobService.pollJob(jobRef, Sleeper.DEFAULT, BackOff.STOP_BACKOFF);
assertEquals(null, job);
verify(response, times(1)).getStatusCode();
verify(response, times(1)).getContent();
verify(response, times(1)).getContentType();
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
/** Tests that {@link BigQueryServicesImpl.JobServiceImpl#pollJob} succeeds. */
@Test
public void testPollJobSucceeds() throws IOException, InterruptedException {
Job testJob = new Job();
testJob.setStatus(new JobStatus().setState("DONE"));
when(response.getContentType()).thenReturn(Json.MEDIA_TYPE);
when(response.getStatusCode()).thenReturn(200);
when(response.getContent()).thenReturn(toStream(testJob));
BigQueryServicesImpl.JobServiceImpl jobService =
new BigQueryServicesImpl.JobServiceImpl(bigquery);
JobReference jobRef = new JobReference().setProjectId("projectId").setJobId("jobId");
Job job = jobService.pollJob(jobRef, Sleeper.DEFAULT, BackOff.ZERO_BACKOFF);
assertEquals(testJob, job);
verify(response, times(1)).getStatusCode();
verify(response, times(1)).getContent();
verify(response, times(1)).getContentType();
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
/** Tests that {@link BigQueryServicesImpl.JobServiceImpl#pollJob} fails. */
@Test
public void testPollJobFailed() throws IOException, InterruptedException {
Job testJob = new Job();
testJob.setStatus(new JobStatus().setState("DONE").setErrorResult(new ErrorProto()));
when(response.getContentType()).thenReturn(Json.MEDIA_TYPE);
when(response.getStatusCode()).thenReturn(200);
when(response.getContent()).thenReturn(toStream(testJob));
BigQueryServicesImpl.JobServiceImpl jobService =
new BigQueryServicesImpl.JobServiceImpl(bigquery);
JobReference jobRef = new JobReference().setProjectId("projectId").setJobId("jobId");
Job job = jobService.pollJob(jobRef, Sleeper.DEFAULT, BackOff.ZERO_BACKOFF);
assertEquals(testJob, job);
verify(response, times(1)).getStatusCode();
verify(response, times(1)).getContent();
verify(response, times(1)).getContentType();
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
@Override
public void startLoadJob(JobReference jobRef, JobConfigurationLoad loadConfig)
throws IOException {
synchronized (allJobs) {
verifyUniqueJobId(jobRef.getJobId());
Job job = new Job();
job.setJobReference(jobRef);
job.setConfiguration(new JobConfiguration().setLoad(loadConfig));
job.setKind(" bigquery#job");
job.setStatus(new JobStatus().setState("PENDING"));
// Copy the files to a new location for import, as the temporary files will be deleted by
// the caller.
if (loadConfig.getSourceUris().size() > 0) {
ImmutableList.Builder<ResourceId> sourceFiles = ImmutableList.builder();
ImmutableList.Builder<ResourceId> loadFiles = ImmutableList.builder();
for (String filename : loadConfig.getSourceUris()) {
sourceFiles.add(FileSystems.matchNewResource(filename, false /* isDirectory */));
loadFiles.add(
FileSystems.matchNewResource(
filename + ThreadLocalRandom.current().nextInt(), false /* isDirectory */));
}
FileSystems.copy(sourceFiles.build(), loadFiles.build());
filesForLoadJobs.put(jobRef.getProjectId(), jobRef.getJobId(), loadFiles.build());
}
allJobs.put(jobRef.getProjectId(), jobRef.getJobId(), new JobInfo(job));
}
}
代码示例来源:origin: com.google.cloud/gcloud-java-bigquery
Job toPb() {
Job jobPb = new Job();
jobPb.setEtag(etag);
jobPb.setId(generatedId);
jobPb.setSelfLink(selfLink);
jobPb.setUserEmail(userEmail);
if (jobId != null) {
jobPb.setJobReference(jobId.toPb());
}
if (status != null) {
jobPb.setStatus(status.toPb());
}
if (statistics != null) {
jobPb.setStatistics(statistics.toPb());
}
jobPb.setConfiguration(configuration.toPb());
return jobPb;
}
代码示例来源:origin: com.google.cloud/google-cloud-bigquery
Job toPb() {
Job jobPb = new Job();
jobPb.setEtag(etag);
jobPb.setId(generatedId);
jobPb.setSelfLink(selfLink);
jobPb.setUserEmail(userEmail);
if (jobId != null) {
jobPb.setJobReference(jobId.toPb());
}
if (status != null) {
jobPb.setStatus(status.toPb());
}
if (statistics != null) {
jobPb.setStatistics(statistics.toPb());
}
if (configuration != null) {
jobPb.setConfiguration(configuration.toPb());
}
return jobPb;
}
代码示例来源:origin: com.google.gcloud/gcloud-java-bigquery
Job toPb() {
Job jobPb = new Job();
jobPb.setEtag(etag);
jobPb.setId(generatedId);
jobPb.setSelfLink(selfLink);
jobPb.setUserEmail(userEmail);
if (jobId != null) {
jobPb.setJobReference(jobId.toPb());
}
if (status != null) {
jobPb.setStatus(status.toPb());
}
if (statistics != null) {
jobPb.setStatistics(statistics.toPb());
}
jobPb.setConfiguration(configuration.toPb());
return jobPb;
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
@Override
public void startExtractJob(JobReference jobRef, JobConfigurationExtract extractConfig)
throws IOException {
checkArgument(
"AVRO".equals(extractConfig.getDestinationFormat()), "Only extract to AVRO is supported");
synchronized (allJobs) {
verifyUniqueJobId(jobRef.getJobId());
++numExtractJobCalls;
Job job = new Job();
job.setJobReference(jobRef);
job.setConfiguration(new JobConfiguration().setExtract(extractConfig));
job.setKind(" bigquery#job");
job.setStatus(new JobStatus().setState("PENDING"));
allJobs.put(jobRef.getProjectId(), jobRef.getJobId(), new JobInfo(job));
}
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
@Override
public void startQueryJob(JobReference jobRef, JobConfigurationQuery query) {
synchronized (allJobs) {
Job job = new Job();
job.setJobReference(jobRef);
job.setConfiguration(new JobConfiguration().setQuery(query));
job.setKind(" bigquery#job");
job.setStatus(new JobStatus().setState("PENDING"));
allJobs.put(jobRef.getProjectId(), jobRef.getJobId(), new JobInfo(job));
}
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
@Override
public void startCopyJob(JobReference jobRef, JobConfigurationTableCopy copyConfig)
throws IOException {
synchronized (allJobs) {
verifyUniqueJobId(jobRef.getJobId());
Job job = new Job();
job.setJobReference(jobRef);
job.setConfiguration(new JobConfiguration().setCopy(copyConfig));
job.setKind(" bigquery#job");
job.setStatus(new JobStatus().setState("PENDING"));
allJobs.put(jobRef.getProjectId(), jobRef.getJobId(), new JobInfo(job));
}
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform
job.job.getStatus().setState("RUNNING");
} else if (job.getJobCount == 2 * GET_JOBS_TRANSITION_INTERVAL + 1) {
job.job.setStatus(runJob(job.job));
代码示例来源:origin: com.google.gcloud/gcloud-java-bigquery
@Override
public Job apply(JobList.Jobs jobPb) {
JobStatus statusPb = jobPb.getStatus() != null
? jobPb.getStatus() : new JobStatus();
if (statusPb.getState() == null) {
statusPb.setState(jobPb.getState());
}
if (statusPb.getErrorResult() == null) {
statusPb.setErrorResult(jobPb.getErrorResult());
}
return new Job()
.setConfiguration(jobPb.getConfiguration())
.setId(jobPb.getId())
.setJobReference(jobPb.getJobReference())
.setKind(jobPb.getKind())
.setStatistics(jobPb.getStatistics())
.setStatus(statusPb)
.setUserEmail(jobPb.getUserEmail());
}
}));
代码示例来源:origin: com.google.cloud/gcloud-java-bigquery
@Override
public Job apply(JobList.Jobs jobPb) {
JobStatus statusPb = jobPb.getStatus() != null
? jobPb.getStatus() : new JobStatus();
if (statusPb.getState() == null) {
statusPb.setState(jobPb.getState());
}
if (statusPb.getErrorResult() == null) {
statusPb.setErrorResult(jobPb.getErrorResult());
}
return new Job()
.setConfiguration(jobPb.getConfiguration())
.setId(jobPb.getId())
.setJobReference(jobPb.getJobReference())
.setKind(jobPb.getKind())
.setStatistics(jobPb.getStatistics())
.setStatus(statusPb)
.setUserEmail(jobPb.getUserEmail());
}
}));
代码示例来源:origin: com.google.cloud/google-cloud-bigquery
@Override
public Job apply(JobList.Jobs jobPb) {
JobStatus statusPb =
jobPb.getStatus() != null ? jobPb.getStatus() : new JobStatus();
if (statusPb.getState() == null) {
statusPb.setState(jobPb.getState());
}
if (statusPb.getErrorResult() == null) {
statusPb.setErrorResult(jobPb.getErrorResult());
}
return new Job()
.setConfiguration(jobPb.getConfiguration())
.setId(jobPb.getId())
.setJobReference(jobPb.getJobReference())
.setKind(jobPb.getKind())
.setStatistics(jobPb.getStatistics())
.setStatus(statusPb)
.setUserEmail(jobPb.getUserEmail());
}
}));
内容来源于网络,如有侵权,请联系作者删除!