From notifications-return-889-archive-asf-public=cust-asf.ponee.io@nemo.apache.org Mon Sep 9 06:18:37 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id DFAF5180608 for ; Mon, 9 Sep 2019 08:18:36 +0200 (CEST) Received: (qmail 22626 invoked by uid 500); 9 Sep 2019 06:18:36 -0000 Mailing-List: contact notifications-help@nemo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nemo.apache.org Delivered-To: mailing list notifications@nemo.apache.org Received: (qmail 22617 invoked by uid 99); 9 Sep 2019 06:18:36 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Sep 2019 06:18:36 +0000 From: GitBox To: notifications@nemo.apache.org Subject: [GitHub] [incubator-nemo] alapha23 commented on a change in pull request #187: [NEMO-324] Distinguish Beam's run and waitUntilFinish methods Message-ID: <156800991620.1975.15216375510390013485.gitbox@gitbox.apache.org> Date: Mon, 09 Sep 2019 06:18:36 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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_r322077917 ########## 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); + if (finished) { + LOG.info("Job successfully finished before timeout of {}ms, while waiting until finish", + duration.getMillis()); + return State.DONE; + } else { + LOG.warn("Job timed out before {}ms, while waiting until finish. Call 'cancel' to cancel the job.", + duration.getMillis()); + return State.RUNNING; + } + } + } catch (final Exception e) { + throw new RuntimeException(e); + } // return (State) super.waitUntilJobFinish(duration.getMillis(), TimeUnit.MILLISECONDS); Review comment: Why do we have this line commented out here? ---------------------------------------------------------------- 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