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_r265447457
 
 

 ##########
 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:
   If the job is not finished until the duration, I think it should just return 
the current state of the job, 
   instead of shutting down the job here.  
   Users can decide to wait more or shut down right now by calling 
`PipelineResult.cancel()`. 
   @wonook What do you think?  

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