tysonjh commented on a change in pull request #14026:
URL: https://github.com/apache/beam/pull/14026#discussion_r582327604



##########
File path: release/src/main/groovy/mobilegaming-java-dataflow.groovy
##########
@@ -110,7 +110,14 @@ class LeaderBoardRunner {
     }
     InjectorThread.stop()
     LeaderBoardThread.stop()
-    t.run("gcloud dataflow jobs cancel \$(gcloud dataflow jobs list | grep 
${jobName} | grep Running | cut -d' ' -f1)")
+    t.run("""RUNNING_JOB=`gcloud dataflow jobs list | grep ${jobName} | grep 
Running | cut -d' ' -f1`
+if [ ! -z "\${RUNNING_JOB}" ] 
+  then 
+    gcloud dataflow jobs cancel \${RUNNING_JOB}
+  else 
+    echo "Job '${jobName}' is not running."
+fi 
+""")

Review comment:
       Jobs were finished/cancelled during my testing. I didn't see any in 
pending, there are a lot of sleeps/loops above but I suppose it could happen. 
We could search for 'Running\|Pending' if that makes sense.
   
   I'm not sure a retry for cancelling will be that helpful here. If the job 
isn't present in the list as Running, or Pending, it won't need cancelling 
right?
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to