nemo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nemo] alapha23 commented on a change in pull request #187: [NEMO-324] Distinguish Beam's run and waitUntilFinish methods
Date Mon, 09 Sep 2019 07:41:42 GMT
alapha23 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_r322089908
 
 

 ##########
 File path: client/src/main/java/org/apache/nemo/client/beam/NemoPipelineResult.java
 ##########
 @@ -44,14 +59,36 @@ public State getState() {
 
   @Override
   public State cancel() throws IOException {
-    throw new UnsupportedOperationException("cancel() in frontend.beam.NemoPipelineResult");
+    try {
+      JobLauncher.shutdown();
+      this.jobDone.await();
+      return State.CANCELLED;
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
   }
 
   @Override
   public State waitUntilFinish(final Duration duration) {
-    throw new UnsupportedOperationException();
-    // TODO #208: NemoPipelineResult#waitUntilFinish hangs
-    // Previous code that hangs the job:
+    try {
+      if (duration.getMillis() < 1) {
+        this.jobDone.await();
+        return State.DONE;
+      } else {
+        final boolean finished = this.jobDone.await(duration.getMillis(), TimeUnit.MILLISECONDS);
 
 Review comment:
   Currently all test files seem to use waitUntilFinish(), so this if branch is not tested.
   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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message