[ 
https://issues.apache.org/jira/browse/BEAM-6725?focusedWorklogId=205870&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-205870
 ]

ASF GitHub Bot logged work on BEAM-6725:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Feb/19 17:03
            Start Date: 28/Feb/19 17:03
    Worklog Time Spent: 10m 
      Work Description: angoenka commented on pull request #7941: [BEAM-6725] 
share some Flink job invocation code with Samza runner
URL: https://github.com/apache/beam/pull/7941#discussion_r261292917
 
 

 ##########
 File path: 
runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/jobsubmission/JobInvocation.java
 ##########
 @@ -17,31 +17,173 @@
  */
 package org.apache.beam.runners.fnexecution.jobsubmission;
 
+import static 
org.apache.beam.vendor.guava.v20_0.com.google.common.base.Preconditions.checkArgument;
+import static 
org.apache.beam.vendor.guava.v20_0.com.google.common.base.Throwables.getRootCause;
+import static 
org.apache.beam.vendor.guava.v20_0.com.google.common.base.Throwables.getStackTraceAsString;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.function.Consumer;
+import javax.annotation.Nullable;
 import org.apache.beam.model.jobmanagement.v1.JobApi.JobMessage;
 import org.apache.beam.model.jobmanagement.v1.JobApi.JobState;
 import org.apache.beam.model.jobmanagement.v1.JobApi.JobState.Enum;
+import org.apache.beam.model.pipeline.v1.RunnerApi;
+import org.apache.beam.model.pipeline.v1.RunnerApi.Pipeline;
+import org.apache.beam.sdk.PipelineResult;
+import 
org.apache.beam.vendor.guava.v20_0.com.google.common.util.concurrent.FutureCallback;
+import 
org.apache.beam.vendor.guava.v20_0.com.google.common.util.concurrent.Futures;
+import 
org.apache.beam.vendor.guava.v20_0.com.google.common.util.concurrent.ListenableFuture;
+import 
org.apache.beam.vendor.guava.v20_0.com.google.common.util.concurrent.ListeningExecutorService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /** Internal representation of a Job which has been invoked (prepared and run) 
by a client. */
-public interface JobInvocation {
+public abstract class JobInvocation {
+
+  protected abstract PipelineResult run(Pipeline pipeline) throws Exception;
+
+  protected final RunnerApi.Pipeline pipeline;
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(JobInvocation.class);
+
+  private final String id;
+  private final String retrievalToken;
+  private final ListeningExecutorService executorService;
+  private List<Consumer<Enum>> stateObservers;
+  private List<Consumer<JobMessage>> messageObservers;
+  private JobState.Enum jobState;
+  @Nullable private ListenableFuture<PipelineResult> invocationFuture;
+
+  protected JobInvocation(
+      String id,
+      String retrievalToken,
+      ListeningExecutorService executorService,
+      Pipeline pipeline) {
+    this.id = id;
+    this.retrievalToken = retrievalToken;
 
 Review comment:
   It is a bit confusing to expose retrivalToken as part of the JobInvocation 
and will not be used by JobInvocation users.
   Based on the following comment to make JobInvocation a concrete class, we 
can just keep retrieval token in FlinkJobInvocation.
 
----------------------------------------------------------------
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: 205870)
    Time Spent: 3h 20m  (was: 3h 10m)

> Move runner-agnostic code out of FlinkJobInvocation
> ---------------------------------------------------
>
>                 Key: BEAM-6725
>                 URL: https://issues.apache.org/jira/browse/BEAM-6725
>             Project: Beam
>          Issue Type: Task
>          Components: runner-flink, runner-samza, runner-spark
>            Reporter: Kyle Weaver
>            Assignee: Kyle Weaver
>            Priority: Major
>              Labels: portability
>          Time Spent: 3h 20m
>  Remaining Estimate: 0h
>
> Like BEAM-6714, FlinkJobInvocation contains some code (for asynchronously 
> running jobs) that isn't really Flink specific and therefore could/should be 
> reused by other portable runners. I'm thinking instead of an interface, 
> JobInvocation should be made an abstract class that implements the methods 
> that it currently abstracts, with an abstract method `runPipeline` for the 
> runner-specific details.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to