Dataproc Job Submit Via API

Viewed 158

I have streaming job running which will run forever and will execute the query on Kafka topic, I am going through DataProc Documentation for submitting a job via Java, here is the link

 // Submit an asynchronous request to execute the job.
      OperationFuture<Job, JobMetadata> submitJobAsOperationAsyncRequest =
          jobControllerClient.submitJobAsOperationAsync(projectId, region, job);

      Job response = submitJobAsOperationAsyncRequest.get();

For the above line of code I am not able to get the response , the above code keeps on running ? Is it because it's streaming job and it's running forever ?

How I can get a response ? So to end user I can provide some job information like URL where they can see their Jobs or any monitoring dashaborad

1 Answers

The OperationFuture<Job, JobMetadata> class has a getMetadata() method which returns a com.google.api.core.ApiFuture<JobMetadata>. You can get the job metadata before the job finishes by calling jobMetadataApiFuture.get().

See more details about the OperationFuture.getMetadata() method and the ApiFuture class.

Related