You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by mx...@apache.org on 2016/03/21 11:44:52 UTC

[1/3] incubator-beam git commit: [flink] add test case for Runner registration

Repository: incubator-beam
Updated Branches:
  refs/heads/master fcc6f3cfd -> c984f3ae2


[flink] add test case for Runner registration


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/ba7b7a04
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/ba7b7a04
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/ba7b7a04

Branch: refs/heads/master
Commit: ba7b7a0447417b8c08c0748a5d60b598da7b8e4e
Parents: 086a35e
Author: Maximilian Michels <mx...@apache.org>
Authored: Mon Mar 21 11:36:35 2016 +0100
Committer: Maximilian Michels <mx...@apache.org>
Committed: Mon Mar 21 11:38:30 2016 +0100

----------------------------------------------------------------------
 .../runners/flink/FlinkRunnerRegistrarTest.java | 48 ++++++++++++++++++++
 1 file changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/ba7b7a04/runners/flink/runner/src/test/java/org/apache/beam/runners/flink/FlinkRunnerRegistrarTest.java
----------------------------------------------------------------------
diff --git a/runners/flink/runner/src/test/java/org/apache/beam/runners/flink/FlinkRunnerRegistrarTest.java b/runners/flink/runner/src/test/java/org/apache/beam/runners/flink/FlinkRunnerRegistrarTest.java
new file mode 100644
index 0000000..45ca830
--- /dev/null
+++ b/runners/flink/runner/src/test/java/org/apache/beam/runners/flink/FlinkRunnerRegistrarTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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 com.google.cloud.dataflow.sdk.options.PipelineOptions;
+import com.google.cloud.dataflow.sdk.options.PipelineOptionsFactory;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests the proper registration of the Flink runner.
+ */
+public class FlinkRunnerRegistrarTest {
+
+  @Test
+  public void testFullName() {
+    String[] args =
+        new String[] {String.format("--runner=%s", FlinkPipelineRunner.class.getName())};
+    PipelineOptions opts = PipelineOptionsFactory.fromArgs(args).create();
+    assertEquals(opts.getRunner(), FlinkPipelineRunner.class);
+  }
+
+  @Test
+  public void testClassName() {
+    String[] args =
+        new String[] {String.format("--runner=%s", FlinkPipelineRunner.class.getSimpleName())};
+    PipelineOptions opts = PipelineOptionsFactory.fromArgs(args).create();
+    assertEquals(opts.getRunner(), FlinkPipelineRunner.class);
+  }
+
+}


[2/3] incubator-beam git commit: [flink] Add FlinkRunnerRegistrar

Posted by mx...@apache.org.
[flink] Add FlinkRunnerRegistrar

Expose Flink runner and options via AuteService. AuteService will
at compile time populate META-INF/services so that Dataflow sdk
can seamlessly pick up FlinkRunner.

This closes #40.


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/086a35e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/086a35e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/086a35e9

Branch: refs/heads/master
Commit: 086a35e9d0d63d5ec15f2520146923066995492a
Parents: fcc6f3c
Author: Rafal Wojdyla <ra...@spotify.com>
Authored: Fri Mar 11 13:39:55 2016 -0500
Committer: Maximilian Michels <mx...@apache.org>
Committed: Mon Mar 21 11:38:30 2016 +0100

----------------------------------------------------------------------
 runners/flink/runner/pom.xml                    | 12 +++--
 .../runners/flink/FlinkRunnerRegistrar.java     | 56 ++++++++++++++++++++
 2 files changed, 63 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/086a35e9/runners/flink/runner/pom.xml
----------------------------------------------------------------------
diff --git a/runners/flink/runner/pom.xml b/runners/flink/runner/pom.xml
index 212b973..ff4b368 100644
--- a/runners/flink/runner/pom.xml
+++ b/runners/flink/runner/pom.xml
@@ -84,11 +84,6 @@
         </exclusion>
       </exclusions>
     </dependency>
-    <dependency>
-      <groupId>com.google.auto.service</groupId>
-      <artifactId>auto-service</artifactId>
-      <version>1.0-rc2</version>
-    </dependency>
     <!-- Test scoped -->
     <dependency>
       <groupId>com.google.cloud.dataflow</groupId>
@@ -121,6 +116,13 @@
       <version>1.9.5</version>
       <scope>test</scope>
     </dependency>
+    <!-- Optional Pipeline Registration -->
+    <dependency>
+      <groupId>com.google.auto.service</groupId>
+      <artifactId>auto-service</artifactId>
+      <version>1.0-rc2</version>
+      <optional>true</optional>
+    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/086a35e9/runners/flink/runner/src/main/java/org/apache/beam/runners/flink/FlinkRunnerRegistrar.java
----------------------------------------------------------------------
diff --git a/runners/flink/runner/src/main/java/org/apache/beam/runners/flink/FlinkRunnerRegistrar.java b/runners/flink/runner/src/main/java/org/apache/beam/runners/flink/FlinkRunnerRegistrar.java
new file mode 100644
index 0000000..3e30ab9
--- /dev/null
+++ b/runners/flink/runner/src/main/java/org/apache/beam/runners/flink/FlinkRunnerRegistrar.java
@@ -0,0 +1,56 @@
+/*
+ * 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 com.google.auto.service.AutoService;
+import org.apache.beam.runners.flink.FlinkPipelineOptions;
+import org.apache.beam.runners.flink.FlinkPipelineRunner;
+import com.google.cloud.dataflow.sdk.options.PipelineOptions;
+import com.google.cloud.dataflow.sdk.options.PipelineOptionsRegistrar;
+import com.google.cloud.dataflow.sdk.runners.PipelineRunner;
+import com.google.cloud.dataflow.sdk.runners.PipelineRunnerRegistrar;
+import com.google.common.collect.ImmutableList;
+
+
+/**
+ * AuteService registrar - will register FlinkRunner and FlinkOptions
+ * as possible pipeline runner services.
+ *
+ * It ends up in META-INF/services and gets picked up by Dataflow.
+ *
+ */
+public class FlinkRunnerRegistrar {
+  private FlinkRunnerRegistrar() { }
+
+  @AutoService(PipelineRunnerRegistrar.class)
+  public static class Runner implements PipelineRunnerRegistrar {
+    @Override
+    public Iterable<Class<? extends PipelineRunner<?>>> getPipelineRunners() {
+      return ImmutableList.<Class<? extends PipelineRunner<?>>>of(FlinkPipelineRunner.class);
+    }
+  }
+
+  @AutoService(PipelineOptionsRegistrar.class)
+  public static class Options implements PipelineOptionsRegistrar {
+    @Override
+    public Iterable<Class<? extends PipelineOptions>> getPipelineOptions() {
+      return ImmutableList.<Class<? extends PipelineOptions>>of(FlinkPipelineOptions.class);
+    }
+  }
+}


[3/3] incubator-beam git commit: This closes #40

Posted by mx...@apache.org.
This closes #40


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/c984f3ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/c984f3ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/c984f3ae

Branch: refs/heads/master
Commit: c984f3ae2ef22ca98ba353ebe37765f994efb569
Parents: fcc6f3c ba7b7a0
Author: Maximilian Michels <mx...@apache.org>
Authored: Mon Mar 21 11:38:54 2016 +0100
Committer: Maximilian Michels <mx...@apache.org>
Committed: Mon Mar 21 11:38:54 2016 +0100

----------------------------------------------------------------------
 runners/flink/runner/pom.xml                    | 12 +++--
 .../runners/flink/FlinkRunnerRegistrar.java     | 56 ++++++++++++++++++++
 .../runners/flink/FlinkRunnerRegistrarTest.java | 48 +++++++++++++++++
 3 files changed, 111 insertions(+), 5 deletions(-)
----------------------------------------------------------------------