Search in sources :

Example 1 with GetJobsResponse

use of org.apache.beam.model.jobmanagement.v1.JobApi.GetJobsResponse in project beam by apache.

the class InMemoryJobService method getJobs.

@Override
public void getJobs(GetJobsRequest request, StreamObserver<GetJobsResponse> responseObserver) {
    LOG.trace("{} {}", GetJobsRequest.class.getSimpleName(), request);
    try {
        List<JobInfo> result = new ArrayList<>();
        for (JobInvocation invocation : invocations.values()) {
            result.add(invocation.toProto());
        }
        GetJobsResponse response = GetJobsResponse.newBuilder().addAllJobInfo(result).build();
        responseObserver.onNext(response);
        responseObserver.onCompleted();
    } catch (Exception e) {
        LOG.error("Encountered Unexpected Exception", e);
        responseObserver.onError(Status.INTERNAL.withCause(e).asException());
    }
}
Also used : GetJobsResponse(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobsResponse) JobInfo(org.apache.beam.model.jobmanagement.v1.JobApi.JobInfo) ArrayList(java.util.ArrayList) GetJobsRequest(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobsRequest) StatusRuntimeException(org.apache.beam.vendor.grpc.v1p43p2.io.grpc.StatusRuntimeException) StatusException(org.apache.beam.vendor.grpc.v1p43p2.io.grpc.StatusException)

Aggregations

ArrayList (java.util.ArrayList)1 GetJobsRequest (org.apache.beam.model.jobmanagement.v1.JobApi.GetJobsRequest)1 GetJobsResponse (org.apache.beam.model.jobmanagement.v1.JobApi.GetJobsResponse)1 JobInfo (org.apache.beam.model.jobmanagement.v1.JobApi.JobInfo)1 StatusException (org.apache.beam.vendor.grpc.v1p43p2.io.grpc.StatusException)1 StatusRuntimeException (org.apache.beam.vendor.grpc.v1p43p2.io.grpc.StatusRuntimeException)1