From hama-commits-return-1522-apmail-incubator-hama-commits-archive=incubator.apache.org@incubator.apache.org Wed Sep 7 00:54:28 2011 Return-Path: X-Original-To: apmail-incubator-hama-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-hama-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 308CA7020 for ; Wed, 7 Sep 2011 00:54:28 +0000 (UTC) Received: (qmail 58149 invoked by uid 500); 7 Sep 2011 00:54:28 -0000 Delivered-To: apmail-incubator-hama-commits-archive@incubator.apache.org Received: (qmail 58118 invoked by uid 500); 7 Sep 2011 00:54:27 -0000 Mailing-List: contact hama-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hama-dev@incubator.apache.org Delivered-To: mailing list hama-commits@incubator.apache.org Received: (qmail 58110 invoked by uid 99); 7 Sep 2011 00:54:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Sep 2011 00:54:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Sep 2011 00:54:23 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E1FE1238889B; Wed, 7 Sep 2011 00:54:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1165946 - in /incubator/hama/trunk: CHANGES.txt core/src/main/java/org/apache/hama/bsp/BSPMaster.java core/src/main/java/org/apache/hama/bsp/GroomServer.java Date: Wed, 07 Sep 2011 00:54:02 -0000 To: hama-commits@incubator.apache.org From: edwardyoon@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110907005402.E1FE1238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: edwardyoon Date: Wed Sep 7 00:54:02 2011 New Revision: 1165946 URL: http://svn.apache.org/viewvc?rev=1165946&view=rev Log: Groom statuses should be reported periodically Modified: incubator/hama/trunk/CHANGES.txt incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPMaster.java incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/GroomServer.java Modified: incubator/hama/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=1165946&r1=1165945&r2=1165946&view=diff ============================================================================== --- incubator/hama/trunk/CHANGES.txt (original) +++ incubator/hama/trunk/CHANGES.txt Wed Sep 7 00:54:02 2011 @@ -9,6 +9,7 @@ Release 0.4 - Unreleased BUG FIXES + HAMA-429: Groom statuses should be reported periodically (ChiaHung Lin via edwardyoon) HAMA-421: Maven build issues using proxy (Joe Crobak via edwardyoon) IMPROVEMENTS Modified: incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPMaster.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPMaster.java?rev=1165946&r1=1165945&r2=1165946&view=diff ============================================================================== --- incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPMaster.java (original) +++ incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPMaster.java Wed Sep 7 00:54:02 2011 @@ -343,7 +343,7 @@ public class BSPMaster implements JobSub LOG.error("Fail to register GroomServer " + status.getGroomName(), e); return false; } - + LOG.info(status.getGroomName()+" is added."); return true; } Modified: incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/GroomServer.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/GroomServer.java?rev=1165946&r1=1165945&r2=1165946&view=diff ============================================================================== --- incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/GroomServer.java (original) +++ incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/GroomServer.java Wed Sep 7 00:54:02 2011 @@ -271,7 +271,7 @@ public class GroomServer implements Runn // Clear out state tables this.tasks.clear(); this.runningJobs = new TreeMap(); - this.runningTasks = new LinkedHashMap(); + this.runningTasks = new ConcurrentHashMap(); this.finishedTasks = new LinkedHashMap(); this.conf.set(Constants.PEER_HOST, localHostname); this.conf.set(Constants.GROOM_RPC_HOST, localHostname); @@ -418,6 +418,33 @@ public class GroomServer implements Runn public State offerService() throws Exception { while (running && !shuttingDown) { try { + + // Reports to a BSPMaster + for (Map.Entry e : runningTasks + .entrySet()) { + Thread.sleep(REPORT_INTERVAL); + TaskInProgress tip = e.getValue(); + TaskStatus taskStatus = tip.getStatus(); + + if (taskStatus.getRunState() == TaskStatus.State.RUNNING) { + taskStatus.setProgress(taskStatus.getSuperstepCount()); + + if (!tip.runner.isAlive()) { + if (taskStatus.getRunState() != TaskStatus.State.FAILED) { + taskStatus.setRunState(TaskStatus.State.SUCCEEDED); + } + taskStatus.setPhase(TaskStatus.Phase.CLEANUP); + } + } + + doReport(taskStatus); + } + + Thread.sleep(REPORT_INTERVAL); + } catch (InterruptedException ie) { + } + + try { if (justInited) { String dir = masterClient.getSystemDir(); if (dir == null) { @@ -493,7 +520,6 @@ public class GroomServer implements Runn public List updateTaskStatus(TaskStatus taskStatus) { List tlist = new ArrayList(); - synchronized (runningTasks) { if (taskStatus.getRunState() == TaskStatus.State.SUCCEEDED || taskStatus.getRunState() == TaskStatus.State.FAILED) { @@ -506,7 +532,6 @@ public class GroomServer implements Runn tlist.add((TaskStatus) taskStatus.clone()); } - } return tlist; } @@ -958,20 +983,6 @@ public class GroomServer implements Runn @Override public void done(TaskAttemptID taskid, boolean shouldBePromoted) throws IOException { - TaskInProgress tip = runningTasks.get(taskid); - TaskStatus taskStatus = tip.getStatus(); - - if (taskStatus.getRunState() == TaskStatus.State.RUNNING) { - taskStatus.setProgress(taskStatus.getSuperstepCount()); - - if (taskStatus.getRunState() != TaskStatus.State.FAILED) { - taskStatus.setRunState(TaskStatus.State.SUCCEEDED); - taskStatus.setPhase(TaskStatus.Phase.CLEANUP); - } - } - - // TODO reduce the reporting times. - doReport(taskStatus); } @Override