mbaijal commented on a change in pull request #8034: Kill running PR builds 
when a new build is triggered for the same PR
URL: https://github.com/apache/incubator-mxnet/pull/8034#discussion_r141158264
 
 

 ##########
 File path: Jenkinsfile
 ##########
 @@ -11,14 +11,36 @@ max_time = 120
 // assign any caught errors here
 err = null
 
+//Method to Kill PR Builds that are running currently when a new build is 
triggered.
+def abortPreviousRunningBuilds() {
+  def hi = Hudson.instance
+  def pname = env.JOB_NAME.split('/')[0]
+
+  hi.getItem(pname).getItem(env.JOB_BASE_NAME).getBuilds().each{ build ->
+    def exec = build.getExecutor()
+
+    if (build.number != currentBuild.number && exec != null) {
 
 Review comment:
   1. I believe it does. Merge builds run on master, correct? I should 
definitely add a condition on the function call saying if 'branch_name is not 
master'. I wanted to test what happens on apache before adding that
   
   2. Do the PR builds not get executors in FCFS order? In that case wouldnt 
build #2 always get an executo rbefore build #3? (However, I can think of 
scenarios where the sanity test of build #3 runs befiore build #2 and adding 
this condition seems like a good idea)
 
----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to