This is an automated email from the ASF dual-hosted git repository.

pabloem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 8b41253  Add profiling option to nexmark gradle launching. Passing the 
profiling configuration as an argument does not work because it contains a 
space and is thus spit into separate arguments.
     new 8c6904d  Merge pull request #13938 from scwhittle/nexmark_profile Add 
profiling option to nexmark gradle launching. Passing the
8b41253 is described below

commit 8b412531d0312003d461b896cc40527eeb3fa69c
Author: Sam Whittle <[email protected]>
AuthorDate: Tue Jan 19 03:42:22 2021 -0800

    Add profiling option to nexmark gradle launching. Passing the
    profiling configuration as an argument does not work because it
    contains a space and is thus spit into separate arguments.
---
 sdks/java/testing/nexmark/build.gradle | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/sdks/java/testing/nexmark/build.gradle 
b/sdks/java/testing/nexmark/build.gradle
index c7470f4..0d3af35 100644
--- a/sdks/java/testing/nexmark/build.gradle
+++ b/sdks/java/testing/nexmark/build.gradle
@@ -29,6 +29,9 @@ 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"
+// When running via Gradle, this property can be set to "true" to enable 
profiling for
+// the nexmark pipeline. Currently only works for the Dataflow runner.
+def nexmarkProfilingProperty = "nexmark.profile"
 
 // When running via Gradle, this property sets the runner dependency
 def nexmarkRunnerProperty = "nexmark.runner"
@@ -111,6 +114,8 @@ if (shouldProvideSpark) {
 //       Specify the command line for invoking org.apache.beam.sdk.nexmark.Main
 task run(type: JavaExec) {
   def nexmarkArgsStr =  project.findProperty(nexmarkArgsProperty) ?: ""
+  def nexmarkArgsList = new ArrayList<String>()
+  Collections.addAll(nexmarkArgsList, nexmarkArgsStr.split())
 
   if (isDataflowRunner) {
     dependsOn 
":runners:google-cloud-dataflow-java:worker:legacy-worker:shadowJar"
@@ -119,12 +124,16 @@ task run(type: JavaExec) {
     // Provide job with a customizable worker jar.
     // With legacy worker jar, containerImage is set to empty (i.e. to use the 
internal build).
     // More context and discussions can be found in PR#6694.
-    nexmarkArgsStr = nexmarkArgsStr +
-          " --dataflowWorkerJar=${dataflowWorkerJar} " +
-          " --workerHarnessContainerImage="
+    nexmarkArgsList.add("--dataflowWorkerJar=${dataflowWorkerJar}".toString())
+    nexmarkArgsList.add('--workerHarnessContainerImage=')
+
+    def nexmarkProfile =  project.findProperty(nexmarkProfilingProperty) ?: ""
+    if (nexmarkProfile.equals("true")) {
+      nexmarkArgsList.add('--profilingAgentConfiguration={ "APICurated": true 
}')
+    }
   }
 
   main = "org.apache.beam.sdk.nexmark.Main"
   classpath = configurations.gradleRun
-  args nexmarkArgsStr.split()
+  args nexmarkArgsList.toArray()
 }

Reply via email to