public class InMemoryJobService extends org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase implements FnService
JobInvoker
.
Job management is handled in-memory rather than any persistent storage, running the risk of leaking jobs if the InMemoryJobService crashes.
TODO: replace in-memory job management state with persistent solution.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_INVOCATION_HISTORY
The default maximum number of completed invocations to keep.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel(org.apache.beam.model.jobmanagement.v1.JobApi.CancelJobRequest request,
org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.CancelJobResponse> responseObserver) |
void |
close()
.
|
static InMemoryJobService |
create(GrpcFnServer<ArtifactStagingService> stagingService,
java.util.function.Function<java.lang.String,java.lang.String> stagingServiceTokenProvider,
ThrowingConsumer<java.lang.Exception,java.lang.String> cleanupJobFn,
JobInvoker invoker)
Creates an InMemoryJobService.
|
static InMemoryJobService |
create(GrpcFnServer<ArtifactStagingService> stagingService,
java.util.function.Function<java.lang.String,java.lang.String> stagingServiceTokenProvider,
ThrowingConsumer<java.lang.Exception,java.lang.String> cleanupJobFn,
JobInvoker invoker,
int maxInvocationHistory)
Creates an InMemoryJobService.
|
void |
describePipelineOptions(org.apache.beam.model.jobmanagement.v1.JobApi.DescribePipelineOptionsRequest request,
org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.DescribePipelineOptionsResponse> responseObserver) |
void |
getJobMetrics(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobMetricsRequest request,
org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.GetJobMetricsResponse> responseObserver) |
void |
getJobs(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobsRequest request,
org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.GetJobsResponse> responseObserver) |
void |
getMessageStream(org.apache.beam.model.jobmanagement.v1.JobApi.JobMessagesRequest request,
org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.JobMessagesResponse> responseObserver) |
void |
getPipeline(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobPipelineRequest request,
org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.GetJobPipelineResponse> responseObserver) |
void |
getState(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobStateRequest request,
org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.JobStateEvent> responseObserver) |
void |
getStateStream(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobStateRequest request,
org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.JobStateEvent> responseObserver) |
void |
prepare(org.apache.beam.model.jobmanagement.v1.JobApi.PrepareJobRequest request,
org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.PrepareJobResponse> responseObserver) |
void |
run(org.apache.beam.model.jobmanagement.v1.JobApi.RunJobRequest request,
org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.RunJobResponse> responseObserver) |
bindService
public static final int DEFAULT_MAX_INVOCATION_HISTORY
public static InMemoryJobService create(GrpcFnServer<ArtifactStagingService> stagingService, java.util.function.Function<java.lang.String,java.lang.String> stagingServiceTokenProvider, ThrowingConsumer<java.lang.Exception,java.lang.String> cleanupJobFn, JobInvoker invoker)
stagingService
- The staging service.stagingServiceTokenProvider
- Function mapping a preparationId to a staging service token.cleanupJobFn
- A cleanup function to run, parameterized with the staging token of a job.invoker
- A JobInvoker which creates the jobs.public static InMemoryJobService create(GrpcFnServer<ArtifactStagingService> stagingService, java.util.function.Function<java.lang.String,java.lang.String> stagingServiceTokenProvider, ThrowingConsumer<java.lang.Exception,java.lang.String> cleanupJobFn, JobInvoker invoker, int maxInvocationHistory)
stagingService
- The staging service.stagingServiceTokenProvider
- Function mapping a preparationId to a staging service token.cleanupJobFn
- A cleanup function to run, parameterized with the staging token of a job.invoker
- A JobInvoker which creates the jobs.maxInvocationHistory
- The maximum number of completed invocations to keep.public void prepare(org.apache.beam.model.jobmanagement.v1.JobApi.PrepareJobRequest request, org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.PrepareJobResponse> responseObserver)
prepare
in class org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase
public void run(org.apache.beam.model.jobmanagement.v1.JobApi.RunJobRequest request, org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.RunJobResponse> responseObserver)
run
in class org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase
public void getJobs(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobsRequest request, org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.GetJobsResponse> responseObserver)
getJobs
in class org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase
public void getState(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobStateRequest request, org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.JobStateEvent> responseObserver)
getState
in class org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase
public void getPipeline(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobPipelineRequest request, org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.GetJobPipelineResponse> responseObserver)
getPipeline
in class org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase
public void cancel(org.apache.beam.model.jobmanagement.v1.JobApi.CancelJobRequest request, org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.CancelJobResponse> responseObserver)
cancel
in class org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase
public void getStateStream(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobStateRequest request, org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.JobStateEvent> responseObserver)
getStateStream
in class org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase
public void getMessageStream(org.apache.beam.model.jobmanagement.v1.JobApi.JobMessagesRequest request, org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.JobMessagesResponse> responseObserver)
getMessageStream
in class org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase
public void getJobMetrics(org.apache.beam.model.jobmanagement.v1.JobApi.GetJobMetricsRequest request, org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.GetJobMetricsResponse> responseObserver)
getJobMetrics
in class org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase
public void describePipelineOptions(org.apache.beam.model.jobmanagement.v1.JobApi.DescribePipelineOptionsRequest request, org.apache.beam.vendor.grpc.v1p36p0.io.grpc.stub.StreamObserver<org.apache.beam.model.jobmanagement.v1.JobApi.DescribePipelineOptionsResponse> responseObserver)
describePipelineOptions
in class org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase
public void close() throws java.lang.Exception
FnService
There should be no more calls to any service method by the time a call to FnService.close()
begins. Specifically, this means that a Server
that this service is bound to should have
completed a call to the Server.shutdown()
method, and all future incoming calls will be rejected.