wonook 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_r326232364
##########
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:
I could add a test that tests the functionality. Thanks for pointing out!
----------------------------------------------------------------
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