From a0026af60c5084b29522ce5c4c9a947ba203e78c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de>
Date: Thu, 24 Mar 2022 11:57:40 +0100
Subject: [PATCH] Add subprojects for Dataflow impl. of UC1 and UC3

---
 .../groovy/theodolite.beam.dataflow.gradle    |  7 ++++++
 theodolite-benchmarks/settings.gradle         |  3 +++
 .../uc1-beam-dataflow/.gitignore              |  1 +
 .../uc1-beam-dataflow/Dockerfile              |  9 ++++++++
 .../uc1-beam-dataflow/build.gradle            | 19 +++++++++++++++
 .../uc1/beam/dataflow/Uc1BeamDataflow.java    | 21 +++++++++++++++++
 .../uc3-beam-dataflow/.gitignore              |  1 +
 .../uc3-beam-dataflow/Dockerfile              |  8 +++++++
 .../uc3-beam-dataflow/build.gradle            | 19 +++++++++++++++
 .../uc3/beam/dataflow/Uc3BeamDataflow.java    | 23 +++++++++++++++++++
 10 files changed, 111 insertions(+)
 create mode 100644 theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.beam.dataflow.gradle
 create mode 100644 theodolite-benchmarks/uc1-beam-dataflow/.gitignore
 create mode 100644 theodolite-benchmarks/uc1-beam-dataflow/Dockerfile
 create mode 100644 theodolite-benchmarks/uc1-beam-dataflow/build.gradle
 create mode 100644 theodolite-benchmarks/uc1-beam-dataflow/src/main/java/rocks/theodolite/benchmarks/uc1/beam/dataflow/Uc1BeamDataflow.java
 create mode 100644 theodolite-benchmarks/uc3-beam-dataflow/.gitignore
 create mode 100644 theodolite-benchmarks/uc3-beam-dataflow/Dockerfile
 create mode 100644 theodolite-benchmarks/uc3-beam-dataflow/build.gradle
 create mode 100644 theodolite-benchmarks/uc3-beam-dataflow/src/main/java/rocks/theodolite/benchmarks/uc3/beam/dataflow/Uc3BeamDataflow.java

diff --git a/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.beam.dataflow.gradle b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.beam.dataflow.gradle
new file mode 100644
index 000000000..3499ba449
--- /dev/null
+++ b/theodolite-benchmarks/buildSrc/src/main/groovy/theodolite.beam.dataflow.gradle
@@ -0,0 +1,7 @@
+plugins {
+    id 'theodolite.beam'
+}
+
+dependencies {
+    implementation 'org.apache.beam:beam-runners-google-cloud-dataflow-java:2.35.0'
+}
\ No newline at end of file
diff --git a/theodolite-benchmarks/settings.gradle b/theodolite-benchmarks/settings.gradle
index 776e7d8e4..42651f597 100644
--- a/theodolite-benchmarks/settings.gradle
+++ b/theodolite-benchmarks/settings.gradle
@@ -10,6 +10,7 @@ include 'uc1-commons'
 include 'uc1-kstreams'
 include 'uc1-flink'
 include 'uc1-beam'
+include 'uc1-beam-dataflow'
 include 'uc1-beam-flink'
 include 'uc1-beam-samza'
 
@@ -24,6 +25,7 @@ include 'uc3-load-generator'
 include 'uc3-kstreams'
 include 'uc3-flink'
 include 'uc3-beam'
+include 'uc3-beam-dataflow'
 include 'uc3-beam-flink'
 include 'uc3-beam-samza'
 
@@ -35,3 +37,4 @@ include 'uc4-beam-flink'
 include 'uc4-beam-samza'
 
 include 'http-bridge'
+
diff --git a/theodolite-benchmarks/uc1-beam-dataflow/.gitignore b/theodolite-benchmarks/uc1-beam-dataflow/.gitignore
new file mode 100644
index 000000000..7bf05dd28
--- /dev/null
+++ b/theodolite-benchmarks/uc1-beam-dataflow/.gitignore
@@ -0,0 +1 @@
+state
\ No newline at end of file
diff --git a/theodolite-benchmarks/uc1-beam-dataflow/Dockerfile b/theodolite-benchmarks/uc1-beam-dataflow/Dockerfile
new file mode 100644
index 000000000..cf6ef6675
--- /dev/null
+++ b/theodolite-benchmarks/uc1-beam-dataflow/Dockerfile
@@ -0,0 +1,9 @@
+FROM openjdk:11-slim
+
+ENV MAX_SOURCE_PARALLELISM=1024
+
+ADD build/distributions/uc1-beam-samza.tar /
+ADD samza-standalone.properties /
+
+CMD /uc1-beam-samza/bin/uc1-beam-samza --configFilePath=samza-standalone.properties --samzaExecutionEnvironment=STANDALONE --maxSourceParallelism=$MAX_SOURCE_PARALLELISM --enableMetrics=false --configOverride="{\"job.coordinator.zk.connect\":\"$SAMZA_JOB_COORDINATOR_ZK_CONNECT\"}"
+
diff --git a/theodolite-benchmarks/uc1-beam-dataflow/build.gradle b/theodolite-benchmarks/uc1-beam-dataflow/build.gradle
new file mode 100644
index 000000000..21ffd9450
--- /dev/null
+++ b/theodolite-benchmarks/uc1-beam-dataflow/build.gradle
@@ -0,0 +1,19 @@
+plugins {
+  id 'theodolite.beam.dataflow'
+}
+
+dependencies {
+  implementation project(':uc1-beam')
+}
+
+sourceSets {
+  main {
+    resources {
+      srcDirs += [
+        project(':uc1-beam').sourceSets.main.resources
+      ]
+    }
+  }
+}
+
+mainClassName = "rocks.theodolite.benchmarks.uc1.beam.dataflow.Uc1BeamDataflow"
diff --git a/theodolite-benchmarks/uc1-beam-dataflow/src/main/java/rocks/theodolite/benchmarks/uc1/beam/dataflow/Uc1BeamDataflow.java b/theodolite-benchmarks/uc1-beam-dataflow/src/main/java/rocks/theodolite/benchmarks/uc1/beam/dataflow/Uc1BeamDataflow.java
new file mode 100644
index 000000000..24af2f24d
--- /dev/null
+++ b/theodolite-benchmarks/uc1-beam-dataflow/src/main/java/rocks/theodolite/benchmarks/uc1/beam/dataflow/Uc1BeamDataflow.java
@@ -0,0 +1,21 @@
+package rocks.theodolite.benchmarks.uc1.beam.dataflow;
+
+import org.apache.beam.runners.dataflow.DataflowRunner;
+import rocks.theodolite.benchmarks.commons.beam.BeamService;
+import rocks.theodolite.benchmarks.uc1.beam.PipelineFactory;
+
+/**
+ * Implementation of the use case Database Storage using Apache Beam with the Google Cloud Dataflow
+ * runner.
+ */
+public final class Uc1BeamDataflow {
+
+  private Uc1BeamDataflow() {}
+
+  /**
+   * Main method.
+   */
+  public static void main(final String[] args) {
+    new BeamService(PipelineFactory.factory(), DataflowRunner.class, args).runStandalone();
+  }
+}
diff --git a/theodolite-benchmarks/uc3-beam-dataflow/.gitignore b/theodolite-benchmarks/uc3-beam-dataflow/.gitignore
new file mode 100644
index 000000000..7bf05dd28
--- /dev/null
+++ b/theodolite-benchmarks/uc3-beam-dataflow/.gitignore
@@ -0,0 +1 @@
+state
\ No newline at end of file
diff --git a/theodolite-benchmarks/uc3-beam-dataflow/Dockerfile b/theodolite-benchmarks/uc3-beam-dataflow/Dockerfile
new file mode 100644
index 000000000..54979b8e1
--- /dev/null
+++ b/theodolite-benchmarks/uc3-beam-dataflow/Dockerfile
@@ -0,0 +1,8 @@
+FROM openjdk:11-slim
+
+ENV MAX_SOURCE_PARALLELISM=1024
+
+ADD build/distributions/uc3-beam-samza.tar /
+ADD samza-standalone.properties /
+
+CMD /uc3-beam-samza/bin/uc3-beam-samza --configFilePath=samza-standalone.properties --samzaExecutionEnvironment=STANDALONE --maxSourceParallelism=$MAX_SOURCE_PARALLELISM --enableMetrics=false --configOverride="{\"job.coordinator.zk.connect\":\"$SAMZA_JOB_COORDINATOR_ZK_CONNECT\"}"
diff --git a/theodolite-benchmarks/uc3-beam-dataflow/build.gradle b/theodolite-benchmarks/uc3-beam-dataflow/build.gradle
new file mode 100644
index 000000000..dabf19000
--- /dev/null
+++ b/theodolite-benchmarks/uc3-beam-dataflow/build.gradle
@@ -0,0 +1,19 @@
+plugins {
+  id 'theodolite.beam.dataflow'
+}
+
+dependencies {
+  implementation project(':uc3-beam')
+}
+
+sourceSets {
+  main {
+    resources {
+      srcDirs += [
+        project(':uc3-beam').sourceSets.main.resources
+      ]
+    }
+  }
+}
+
+mainClassName = "rocks.theodolite.benchmarks.uc3.beam.dataflow.Uc3BeamDataflow"
diff --git a/theodolite-benchmarks/uc3-beam-dataflow/src/main/java/rocks/theodolite/benchmarks/uc3/beam/dataflow/Uc3BeamDataflow.java b/theodolite-benchmarks/uc3-beam-dataflow/src/main/java/rocks/theodolite/benchmarks/uc3/beam/dataflow/Uc3BeamDataflow.java
new file mode 100644
index 000000000..5c8bc8c42
--- /dev/null
+++ b/theodolite-benchmarks/uc3-beam-dataflow/src/main/java/rocks/theodolite/benchmarks/uc3/beam/dataflow/Uc3BeamDataflow.java
@@ -0,0 +1,23 @@
+package rocks.theodolite.benchmarks.uc3.beam.dataflow;
+
+import org.apache.beam.runners.dataflow.DataflowRunner;
+import rocks.theodolite.benchmarks.commons.beam.BeamService;
+import rocks.theodolite.benchmarks.uc3.beam.PipelineFactory;
+
+/**
+ * Implementation of the use case Aggregation based on Time Attributes using Apache Beam with the
+ * Google Cloud Dataflow runner.
+ */
+public final class Uc3BeamDataflow {
+
+  private Uc3BeamDataflow() {}
+
+  /**
+   * Start running this microservice.
+   */
+  public static void main(final String[] args) {
+    new BeamService(PipelineFactory.factory(), DataflowRunner.class, args).runStandalone();
+  }
+
+}
+
-- 
GitLab