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

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

                Author: ASF GitHub Bot
            Created on: 15/Nov/18 10:28
            Start Date: 15/Nov/18 10:28
    Worklog Time Spent: 10m 
      Work Description: lgajowy closed pull request #7021: [BEAM-6011] Phrase 
triggering nexmark
URL: https://github.com/apache/beam/pull/7021
 
 
   

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/.test-infra/jenkins/NexmarkBuilder.groovy 
b/.test-infra/jenkins/NexmarkBuilder.groovy
new file mode 100644
index 00000000000..a144f152f7b
--- /dev/null
+++ b/.test-infra/jenkins/NexmarkBuilder.groovy
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+import CommonJobProperties as commonJobProperties
+
+// Class for building NEXMark jobs and suites.
+class NexmarkBuilder {
+
+  private static Map<String, Object> defaultOptions = [
+          'bigQueryTable'          : 'nexmark',
+          'project'                : 'apache-beam-testing',
+          'resourceNameMode'       : 'QUERY_RUNNER_AND_MODE',
+          'exportSummaryToBigQuery': true,
+          'tempLocation'           : 
'gs://temp-storage-for-perf-tests/nexmark',
+          'manageResources'        : false,
+          'monitorJobs'            : true
+  ]
+
+  enum Runner {
+    DATAFLOW("DataflowRunner", ":beam-runners-google-cloud-dataflow-java"),
+    SPARK("SparkRunner", ":beam-runners-spark"),
+    FLINK("FlinkRunner", ":beam-runners-flink_2.11"),
+    DIRECT("DirectRunner", ":beam-runners-direct-java")
+
+    private final String option
+    private final String dependency
+
+    Runner(String option, String dependency) {
+      this.option = option
+      this.dependency = dependency
+    }
+  }
+
+  enum TriggeringContext {
+    PR,
+    POST_COMMIT
+  }
+
+  static void standardJob(context, Runner runner, Map<String, Object> 
jobSpecificOptions, TriggeringContext triggeringContext) {
+    Map<String, Object> options = getFullOptions(jobSpecificOptions, runner, 
triggeringContext)
+
+    options.put('streaming', false)
+    suite(context, "NEXMARK IN BATCH MODE USING ${runner} RUNNER", runner, 
options)
+
+    options.put('streaming', true)
+    suite(context, "NEXMARK IN STREAMING MODE USING ${runner} RUNNER", runner, 
options)
+
+    options.put('queryLanguage', 'sql')
+
+    options.put('streaming', false)
+    suite(context, "NEXMARK IN SQL BATCH MODE USING ${runner} RUNNER", runner, 
options)
+
+    options.put('streaming', true)
+    suite(context, "NEXMARK IN SQL STREAMING MODE USING ${runner} RUNNER", 
runner, options)
+  }
+
+  static void batchOnlyJob(context, Map<String, Object> jobSpecificOptions, 
TriggeringContext triggeringContext) {
+    Runner runner = Runner.SPARK
+    Map<String, Object> options = getFullOptions(jobSpecificOptions, runner, 
triggeringContext)
+    options.put('streaming', false)
+
+    suite(context, "NEXMARK IN BATCH MODE USING ${runner} RUNNER", runner, 
options)
+
+    options.put('queryLanguage', 'sql')
+    suite(context, "NEXMARK IN SQL BATCH MODE USING ${runner} RUNNER", runner, 
options)
+  }
+
+  private
+  static Map<String, Object> getFullOptions(Map<String, Object> 
jobSpecificOptions, Runner runner, TriggeringContext triggeringContext) {
+    Map<String, Object> options = defaultOptions + jobSpecificOptions
+
+    options.put('runner', runner.option)
+    options.put('bigQueryDataset', determineBigQueryDataset(triggeringContext))
+    options
+  }
+
+
+  static void suite(context, String title, Runner runner, Map<String, Object> 
options) {
+    context.steps {
+      shell("echo *** RUN ${title} ***")
+      gradle {
+        rootBuildScriptDir(commonJobProperties.checkoutDir)
+        tasks(':beam-sdks-java-nexmark:run')
+        commonJobProperties.setGradleSwitches(delegate)
+        switches("-Pnexmark.runner=${runner.dependency}")
+        switches("-Pnexmark.args=\"${parseOptions(options)}\"")
+      }
+    }
+  }
+
+  private static String parseOptions(Map<String, Object> options) {
+    options.collect { "--${it.key}=${it.value.toString()}" }.join(' ')
+  }
+
+  private static String determineBigQueryDataset(TriggeringContext 
triggeringContext) {
+    triggeringContext == TriggeringContext.PR ? "nexmark_PRs" : "nexmark"
+  }
+}
diff --git a/.test-infra/jenkins/PhraseTriggeringPostCommitBuilder.groovy 
b/.test-infra/jenkins/PhraseTriggeringPostCommitBuilder.groovy
new file mode 100644
index 00000000000..1fa7d15e77b
--- /dev/null
+++ b/.test-infra/jenkins/PhraseTriggeringPostCommitBuilder.groovy
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+/**
+ * This class is to be used for defining postcommit jobs that are 
phrase-triggered only.
+ *
+ * Purpose of this class is to define common strategies and reporting/building 
parameters
+ * for pre- and post- commit test jobs and unify them across the project.
+ */
+class PhraseTriggeringPostCommitBuilder extends PostcommitJobBuilder {
+  static void postCommitJob(nameBase,
+                            triggerPhrase,
+                            githubUiHint,
+                            scope,
+                            jobDefinition = {}) {
+    new PostcommitJobBuilder(scope, jobDefinition).defineGhprbTriggeredJob(
+            nameBase + "_PR", triggerPhrase, githubUiHint, false)
+  }
+}
diff --git a/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Dataflow.groovy 
b/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Dataflow.groovy
index bb9d8d8817c..e2b788260b7 100644
--- a/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Dataflow.groovy
+++ b/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Dataflow.groovy
@@ -18,7 +18,9 @@
 
 import CommonJobProperties as commonJobProperties
 import NexmarkBigqueryProperties
+import NexmarkBuilder as Nexmark
 import NoPhraseTriggeringPostCommitBuilder
+import PhraseTriggeringPostCommitBuilder
 
 // This job runs the suite of ValidatesRunner tests against the Dataflow 
runner.
 
NoPhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_Dataflow',
@@ -114,3 +116,22 @@ 
NoPhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_
     }
   }
 }
+
+PhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_Dataflow',
+        'Run Dataflow Runner Nexmark Tests', 'Dataflow Runner Nexmark Tests', 
this) {
+
+  description('Runs the Nexmark suite on the Dataflow runner against a Pull 
Request, on demand.')
+
+  commonJobProperties.setTopLevelMainJobProperties(delegate, 'master', 240)
+
+  def final JOB_SPECIFIC_OPTIONS = [
+          'suite' : 'STRESS',
+          'numWorkers' : 4,
+          'maxNumWorkers' : 4,
+          'autoscalingAlgorithm' : 'NONE',
+          'nexmarkParallel' : 16,
+          'enforceEncodability' : true,
+          'enforceImmutability' : true
+  ]
+  Nexmark.standardJob(delegate, Nexmark.Runner.DATAFLOW, JOB_SPECIFIC_OPTIONS, 
Nexmark.TriggeringContext.PR)
+}
diff --git a/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Direct.groovy 
b/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Direct.groovy
index 80dff3cd118..3c14272468f 100644
--- a/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Direct.groovy
+++ b/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Direct.groovy
@@ -18,9 +18,10 @@
 
 import CommonJobProperties as commonJobProperties
 import NexmarkBigqueryProperties
+import NexmarkBuilder as Nexmark
 import NoPhraseTriggeringPostCommitBuilder
+import PhraseTriggeringPostCommitBuilder
 
-// This job runs the suite of ValidatesRunner tests against the Direct runner.
 
NoPhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_Direct',
         'Direct Runner Nexmark Tests', this) {
   description('Runs the Nexmark suite on the Direct runner.')
@@ -98,3 +99,18 @@ 
NoPhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_
     }
   }
 }
+
+PhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_Direct',
+        'Run Direct Runner Nexmark Tests', 'Direct Runner Nexmark Tests', 
this) {
+
+  description('Runs the Nexmark suite on the Direct runner against a Pull 
Request, on demand.')
+
+  commonJobProperties.setTopLevelMainJobProperties(delegate, 'master', 240)
+
+  def final JOB_SPECIFIC_OPTIONS = [
+          'suite' : 'SMOKE',
+          'enforceEncodability' : true,
+          'enforceImmutability' : true
+  ]
+  Nexmark.standardJob(delegate, Nexmark.Runner.DIRECT, JOB_SPECIFIC_OPTIONS, 
Nexmark.TriggeringContext.PR)
+}
diff --git a/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Flink.groovy 
b/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Flink.groovy
index 05434afabaf..c6c6c468cba 100644
--- a/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Flink.groovy
+++ b/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Flink.groovy
@@ -18,7 +18,9 @@
 
 import CommonJobProperties as commonJobProperties
 import NexmarkBigqueryProperties
+import NexmarkBuilder as Nexmark
 import NoPhraseTriggeringPostCommitBuilder
+import PhraseTriggeringPostCommitBuilder
 
 // This job runs the suite of ValidatesRunner tests against the Flink runner.
 
NoPhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_Flink',
@@ -98,3 +100,19 @@ 
NoPhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_
     }
   }
 }
+
+PhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_Flink',
+        'Run Flink Runner Nexmark Tests', 'Flink Runner Nexmark Tests', this) {
+
+  description('Runs the Nexmark suite on the Flink runner against a Pull 
Request, on demand.')
+
+  commonJobProperties.setTopLevelMainJobProperties(delegate, 'master', 240)
+
+  def final JOB_SPECIFIC_OPTIONS = [
+          'suite'        : 'SMOKE',
+          'streamTimeout': 60,
+          'flinkMaster'  : 'local'
+  ]
+
+  Nexmark.standardJob(delegate, Nexmark.Runner.FLINK, JOB_SPECIFIC_OPTIONS, 
Nexmark.TriggeringContext.PR)
+}
diff --git a/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Spark.groovy 
b/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Spark.groovy
index dbf2333c312..0e906dcaf8e 100644
--- a/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Spark.groovy
+++ b/.test-infra/jenkins/job_PostCommit_Java_Nexmark_Spark.groovy
@@ -18,7 +18,9 @@
 
 import CommonJobProperties as commonJobProperties
 import NexmarkBigqueryProperties
+import NexmarkBuilder as Nexmark
 import NoPhraseTriggeringPostCommitBuilder
+import PhraseTriggeringPostCommitBuilder
 
 // This job runs the suite of ValidatesRunner tests against the Spark runner.
 
NoPhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_Spark',
@@ -63,3 +65,19 @@ 
NoPhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_
     }
   }
 }
+
+PhraseTriggeringPostCommitBuilder.postCommitJob('beam_PostCommit_Java_Nexmark_Spark',
+        'Run Spark Runner Nexmark Tests', 'Spark Runner Nexmark Tests', this) {
+
+  description('Runs the Nexmark suite on the Spark runner against a Pull 
Request, on demand.')
+
+  commonJobProperties.setTopLevelMainJobProperties(delegate, 'master', 240)
+
+  def final JOB_SPECIFIC_OPTIONS = [
+          'suite'        : 'SMOKE',
+          'streamTimeout': 60
+  ]
+
+  // Spark doesn't run streaming jobs, therefore run only batch variants.
+  Nexmark.batchOnlyJob(delegate, JOB_SPECIFIC_OPTIONS, 
Nexmark.TriggeringContext.PR)
+}


 

----------------------------------------------------------------
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: 166366)
    Time Spent: 3h 10m  (was: 3h)

> Enable Phrase triggering in Nexmark jobs
> ----------------------------------------
>
>                 Key: BEAM-6011
>                 URL: https://issues.apache.org/jira/browse/BEAM-6011
>             Project: Beam
>          Issue Type: Bug
>          Components: testing
>            Reporter: Lukasz Gajowy
>            Assignee: Lukasz Gajowy
>            Priority: Critical
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> We need to enable Phrase Triggering (running Jenkins jobs from PR) for 
> Nexmark jobs so that we could check if pull requests are not breaking 
> anything before merging them. 
> *Note*: Currently Nexmark jobs run post commit on master and publish their 
> results to BigQuery database. In order not to pollute the results collected 
> for master we should save the results for Pr-triggered jobs in some other 
> tables/datasets or even not save them at all (turn off publishing to BQ).



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

Reply via email to