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

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

                Author: ASF GitHub Bot
            Created on: 18/Jul/18 17:37
            Start Date: 18/Jul/18 17:37
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on a change in pull request #5957: 
[BEAM-4791] Portable Flink runner integration test.
URL: https://github.com/apache/beam/pull/5957#discussion_r203465426
 
 

 ##########
 File path: 
runners/flink/src/test/java/org/apache/beam/runners/flink/PortableExecutionTest.java
 ##########
 @@ -0,0 +1,234 @@
+/*
+ * 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.flink;
+
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import com.google.common.net.HostAndPort;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import java.io.Serializable;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
+import org.apache.beam.fn.harness.FnHarness;
+import org.apache.beam.fn.harness.stream.HarnessStreamObserverFactories;
+import org.apache.beam.model.jobmanagement.v1.JobApi.JobState.Enum;
+import org.apache.beam.model.pipeline.v1.RunnerApi;
+import org.apache.beam.runners.core.construction.PipelineTranslation;
+import org.apache.beam.runners.fnexecution.GrpcFnServer;
+import org.apache.beam.runners.fnexecution.ServerFactory;
+import org.apache.beam.runners.fnexecution.artifact.ArtifactRetrievalService;
+import org.apache.beam.runners.fnexecution.control.ControlClientPool.Source;
+import org.apache.beam.runners.fnexecution.control.DockerJobBundleFactory;
+import 
org.apache.beam.runners.fnexecution.control.FnApiControlClientPoolService;
+import org.apache.beam.runners.fnexecution.control.InstructionRequestHandler;
+import org.apache.beam.runners.fnexecution.environment.EnvironmentFactory;
+import org.apache.beam.runners.fnexecution.environment.RemoteEnvironment;
+import org.apache.beam.runners.fnexecution.logging.GrpcLoggingService;
+import org.apache.beam.runners.fnexecution.provisioning.JobInfo;
+import 
org.apache.beam.runners.fnexecution.provisioning.StaticGrpcProvisionService;
+import org.apache.beam.sdk.Pipeline;
+import org.apache.beam.sdk.coders.BigEndianLongCoder;
+import org.apache.beam.sdk.coders.KvCoder;
+import org.apache.beam.sdk.coders.StringUtf8Coder;
+import org.apache.beam.sdk.fn.IdGenerator;
+import org.apache.beam.sdk.fn.channel.ManagedChannelFactory;
+import org.apache.beam.sdk.options.PipelineOptionsFactory;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.GroupByKey;
+import org.apache.beam.sdk.transforms.Impulse;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.transforms.WithKeys;
+import org.apache.beam.sdk.values.KV;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Tests the execution of a pipeline from specification to execution on the 
portable Flink runner.
+ * Exercises job invocation, executable stage translation and deployment with 
embedded Flink for
+ * batch and streaming.
+ */
+@RunWith(Parameterized.class)
+public class PortableExecutionTest implements Serializable {
+
+  @Parameters
+  public static Object[] data() {
+    return new Object[] {true, false};
+  }
+
+  @Parameter public boolean isStreaming;
+
+  private transient ExecutorService sdkHarnessExecutor;
+  private transient Future<?> sdkHarnessExecutorFuture;
+
+  private DockerJobBundleFactory createJobBundleFactory(JobInfo jobInfo) 
throws Exception {
+    return new DockerJobBundleFactory(jobInfo) {
+
+      @Override
+      protected ServerFactory getServerFactory() {
+        return ServerFactory.createWithUrlFactory(
+            (host, port) -> HostAndPort.fromParts("localhost", 
port).toString());
+        //return InProcessServerFactory.create();
+      }
+
+      @Override
+      protected EnvironmentFactory getEnvironmentFactory(
 
 Review comment:
   Please re-use the existing `InProcessEnvironmentFactory` since it does a 
good portion of what you want to do here.
   
   Also consider taking a look at `InProcessSdkHarness` which is a test rule 
which spins up an SDK harness in process. I don't think it will be overly 
useful though unless you can get a good way to inject the `SdkHarnessClient` 
that it provides into the Flink runtime instead of the current method of 
setting a specific instance in the `DockerJobBundleFactory`.

----------------------------------------------------------------
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: 124516)
    Time Spent: 3h 40m  (was: 3.5h)

> Integration test for portable Flink runner basic batch/streaming execution
> --------------------------------------------------------------------------
>
>                 Key: BEAM-4791
>                 URL: https://issues.apache.org/jira/browse/BEAM-4791
>             Project: Beam
>          Issue Type: Task
>          Components: runner-flink
>            Reporter: Thomas Weise
>            Assignee: Thomas Weise
>            Priority: Major
>              Labels: portability
>          Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> Run a simple pipeline in embedded mode to verify the basic workings of 
> JobInvocation/translation/execution for both, batch and streaming. Although 
> there will be some overlap with (future) ValidatesRunner, this test is meant 
> to run as part of the unit tests. 



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

Reply via email to