[
https://issues.apache.org/jira/browse/BEAM-4071?focusedWorklogId=93534&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-93534
]
ASF GitHub Bot logged work on BEAM-4071:
----------------------------------------
Author: ASF GitHub Bot
Created on: 21/Apr/18 01:44
Start Date: 21/Apr/18 01:44
Worklog Time Spent: 10m
Work Description: bsidhom commented on a change in pull request #5150:
[BEAM-4071] Add Portable Runner Job API shim
URL: https://github.com/apache/beam/pull/5150#discussion_r183196129
##########
File path:
runners/reference/java/src/main/java/org/apache/beam/runners/reference/testing/TestJobService.java
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.runners.reference.testing;
+
+import io.grpc.stub.StreamObserver;
+import org.apache.beam.model.jobmanagement.v1.JobApi.CancelJobRequest;
+import org.apache.beam.model.jobmanagement.v1.JobApi.CancelJobResponse;
+import org.apache.beam.model.jobmanagement.v1.JobApi.GetJobStateRequest;
+import org.apache.beam.model.jobmanagement.v1.JobApi.GetJobStateResponse;
+import org.apache.beam.model.jobmanagement.v1.JobApi.JobMessagesRequest;
+import org.apache.beam.model.jobmanagement.v1.JobApi.JobMessagesResponse;
+import org.apache.beam.model.jobmanagement.v1.JobApi.JobState;
+import org.apache.beam.model.jobmanagement.v1.JobApi.PrepareJobRequest;
+import org.apache.beam.model.jobmanagement.v1.JobApi.PrepareJobResponse;
+import org.apache.beam.model.jobmanagement.v1.JobApi.RunJobRequest;
+import org.apache.beam.model.jobmanagement.v1.JobApi.RunJobResponse;
+import
org.apache.beam.model.jobmanagement.v1.JobServiceGrpc.JobServiceImplBase;
+import org.apache.beam.model.pipeline.v1.Endpoints.ApiServiceDescriptor;
+
+/**
+ * A JobService for tests.
+ *
+ * <p>A {@link TestJobService} always returns a fixed staging endpoint, job
preparation id, job id,
+ * and job state. As soon as a job is run, it is put into the given job state.
+ */
+public class TestJobService extends JobServiceImplBase {
+
+ private final ApiServiceDescriptor stagingEndpoint;
+ private final String preparationId;
+ private final String jobId;
+ private final JobState.Enum jobState;
+
+ public TestJobService(
+ ApiServiceDescriptor stagingEndpoint,
+ String preparationId,
+ String jobId,
+ JobState.Enum jobState) {
+ this.stagingEndpoint = stagingEndpoint;
+ this.preparationId = preparationId;
+ this.jobId = jobId;
+ this.jobState = jobState;
+ }
+
+ @Override
+ public void prepare(
+ PrepareJobRequest request, StreamObserver<PrepareJobResponse>
responseObserver) {
+ responseObserver.onNext(
+ PrepareJobResponse.newBuilder()
+ .setPreparationId(preparationId)
+ .setArtifactStagingEndpoint(stagingEndpoint)
+ .build());
+ responseObserver.onCompleted();
+ }
+
+ @Override
+ public void run(RunJobRequest request, StreamObserver<RunJobResponse>
responseObserver) {
+
responseObserver.onNext(RunJobResponse.newBuilder().setJobId(jobId).build());
+ responseObserver.onCompleted();
+ }
+
+ @Override
+ public void getState(
+ GetJobStateRequest request, StreamObserver<GetJobStateResponse>
responseObserver) {
+
responseObserver.onNext(GetJobStateResponse.newBuilder().setState(jobState).build());
+ responseObserver.onCompleted();
+ }
+
+ @Override
+ public void cancel(CancelJobRequest request,
StreamObserver<CancelJobResponse> responseObserver) {
+ super.cancel(request, responseObserver);
Review comment:
Done.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 93534)
> Portable Runner Job API shim
> ----------------------------
>
> Key: BEAM-4071
> URL: https://issues.apache.org/jira/browse/BEAM-4071
> Project: Beam
> Issue Type: New Feature
> Components: runner-core
> Reporter: Ben Sidhom
> Assignee: Ben Sidhom
> Priority: Minor
> Time Spent: 16h 50m
> Remaining Estimate: 0h
>
> There needs to be a way to execute Java-SDK pipelines against a portable job
> server. The job server itself is expected to be started up out-of-band. The
> "PortableRunner" should take an option indicating the Job API endpoint and
> defer other runner configurations to the backend itself.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)