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

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

                Author: ASF GitHub Bot
            Created on: 11/Apr/18 17:50
            Start Date: 11/Apr/18 17:50
    Worklog Time Spent: 10m 
      Work Description: kennknowles closed pull request #5051: [BEAM-3995] Add 
basic Gradle run task to Nexmark
URL: https://github.com/apache/beam/pull/5051
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sdks/java/nexmark/build.gradle b/sdks/java/nexmark/build.gradle
index 83a3d05f99d..8fcba5fa91b 100644
--- a/sdks/java/nexmark/build.gradle
+++ b/sdks/java/nexmark/build.gradle
@@ -21,6 +21,26 @@ applyJavaNature()
 
 description = "Apache Beam :: SDKs :: Java :: Nexmark"
 
+// When running via Gradle, this property can be used to pass commandline 
arguments
+// to the nexmark launch
+def nexmarkArgsProperty = "nexmark.args"
+def nexmarkArgs = project.hasProperty(nexmarkArgsProperty) ?
+    project.getProperty(nexmarkArgsProperty).split() : []
+
+// When running via Gradle, this property sets the runner dependency
+def nexmarkRunnerProperty = "nexmark.runner"
+def nexmarkRunnerDependency = (project.hasProperty(nexmarkRunnerProperty)
+        ? project.getProperty(nexmarkRunnerProperty)
+        : ":beam-runners-direct-java")
+def shouldProvideSpark = ":beam-runners-spark".equals(nexmarkRunnerDependency)
+
+configurations {
+  // A configuration for running the Nexmark launcher directly from Gradle, 
which
+  // uses Gradle to put the appropriate dependencies on the Classpath rather 
than
+  // bundling them into a fat jar
+  gradleRun
+}
+
 dependencies {
   compile library.java.guava
   shadow project(path: ":beam-sdks-java-core", configuration: "shadow")
@@ -43,8 +63,43 @@ dependencies {
   shadow project(path: ":beam-runners-direct-java", configuration: "shadow")
   shadow library.java.slf4j_jdk14
   testCompile library.java.hamcrest_core
+
+  gradleRun project(path: project.path, configuration: "shadow")
+  gradleRun project(path: nexmarkRunnerDependency, configuration: "shadow")
+
+  // The Spark runner requires the user to provide a Spark dependency. For 
self-contained
+  // runs with the Spark runner, we can provide such a dependency. This is 
deliberately phrased
+  // to not hardcode any runner other than :beam-runners-direct-java
+  if (shouldProvideSpark) {
+    gradleRun library.java.spark_streaming
+    gradleRun library.java.spark_core, {
+      exclude group:"org.slf4j", module:"jul-to-slf4j"
+    }
+  }
+}
+
+if (shouldProvideSpark) {
+  configurations.gradleRun {
+    // Using Spark runner causes a StackOverflowError if slf4j-jdk14 is on the 
classpath
+    exclude group: "org.slf4j", module: "slf4j-jdk14"
+  }
 }
 
 test {
   jvmArgs "-da"
 }
+
+// Execute the Nexmark queries or suites via Gradle.
+//
+// Parameters:
+//   -Pnexmark.runner
+//       Specify a runner subproject, such as ":beam-runners-spark" or 
":beam-runners-flink"
+//       Defaults to ":beam-runners-direct-java"
+//
+//   -Pnexmark.args
+//       Specify the command line for invoking org.apache.beam.sdk.nexmark.Main
+task run(type: JavaExec) {
+  main = "org.apache.beam.sdk.nexmark.Main"
+  classpath = configurations.gradleRun
+  args nexmarkArgs
+}


 

----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 90079)
    Time Spent: 6h 50m  (was: 6h 40m)

> Launch Nexmark suites from gradle and update web page docs
> ----------------------------------------------------------
>
>                 Key: BEAM-3995
>                 URL: https://issues.apache.org/jira/browse/BEAM-3995
>             Project: Beam
>          Issue Type: Sub-task
>          Components: examples-nexmark, website
>            Reporter: Kenneth Knowles
>            Assignee: Kenneth Knowles
>            Priority: Major
>          Time Spent: 6h 50m
>  Remaining Estimate: 0h
>
> Currently our instructions for running Nexmark benchmarks on various runners 
> is pretty tightly tied to Maven. We need a good story for running them with 
> gradle (or just building an executable with gradle and running that 
> standalone).



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

Reply via email to