taegeonum commented on a change in pull request #187: [NEMO-324] Distinguish 
Beam's run and waitUntilFinish methods
URL: https://github.com/apache/incubator-nemo/pull/187#discussion_r265448707
 
 

 ##########
 File path: 
client/src/main/java/org/apache/nemo/client/beam/NemoPipelineResult.java
 ##########
 @@ -64,15 +64,18 @@ public State cancel() throws IOException {
 
   @Override
   public State waitUntilFinish(final Duration duration) {
-    final boolean finished;
     try {
-      finished = this.jobDone.await(duration.getMillis(), 
TimeUnit.MILLISECONDS);
-      if (finished) {
-        LOG.info("Job successfully finished before timeout of {}ms, while 
waiting until finish", duration);
-      } else {
-        LOG.info("Job timed out before {}ms, while waiting until finish.", 
duration);
-        JobLauncher.shutdown();
+      if (duration.getMillis() < 1) {
         this.jobDone.await();
+      } else {
+        final boolean finished = this.jobDone.await(duration.getMillis(), 
TimeUnit.MILLISECONDS);
+        if (finished) {
+          LOG.info("Job successfully finished before timeout of {}ms, while 
waiting until finish", duration);
+        } else {
+          LOG.info("Job timed out before {}ms, while waiting until finish.", 
duration);
+          JobLauncher.shutdown();
 
 Review comment:
   The API says 
   ``` 
      * Waits until the pipeline finishes and returns the final status. It 
times out after the given
      * duration.
      *
      * @param duration The time to wait for the pipeline to finish. Provide a 
value less than 1 ms for an infinite wait.
     * @return The final state of the pipeline or null on timeout.
   ```

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to