incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1004884 - in /incubator/hama/trunk: ./ src/java/org/apache/hama/ src/java/org/apache/hama/bsp/ src/java/org/apache/hama/zookeeper/
Date Wed, 06 Oct 2010 02:42:39 GMT
Author: edwardyoon
Date: Wed Oct  6 02:42:38 2010
New Revision: 1004884

URL: http://svn.apache.org/viewvc?rev=1004884&view=rev
Log:
Add starter classes for ZooKeeper, BSPMaster and GroomServer that implement org.apache.hadoop.util.Tool

Added:
    incubator/hama/trunk/src/java/org/apache/hama/BSPMasterRunner.java
    incubator/hama/trunk/src/java/org/apache/hama/GroomServerRunner.java
    incubator/hama/trunk/src/java/org/apache/hama/ZooKeeperRunner.java
Modified:
    incubator/hama/trunk/CHANGES.txt
    incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMaster.java
    incubator/hama/trunk/src/java/org/apache/hama/bsp/GroomServer.java
    incubator/hama/trunk/src/java/org/apache/hama/zookeeper/QuorumPeer.java

Modified: incubator/hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=1004884&r1=1004883&r2=1004884&view=diff
==============================================================================
--- incubator/hama/trunk/CHANGES.txt (original)
+++ incubator/hama/trunk/CHANGES.txt Wed Oct  6 02:42:38 2010
@@ -46,9 +46,11 @@ Trunk (unreleased changes)
 
   IMPROVEMENTS
     
+    HAMA-293: Add starter classes for ZooKeeper, BSPMaster
+                and GroomServer (Filipe Manana via edwardyoon)
     HAMA-286: Task progress should be monitored (eddieyoon)
     HAMA-287: BSPMaster should use the bsp.master.port config property
-                       when creating its InetSocketAddr instance (Filipe Manana via edwardyoon)
+                when creating its InetSocketAddr instance (Filipe Manana via edwardyoon)
     HAMA-283: Removing duplicate code (Filipe Manana via edwardyoon)
     HAMA-277: Add default number of bsp task (edwardyoon)
     HAMA-273: Implement killJob() method for local job (edwardyoon)

Added: incubator/hama/trunk/src/java/org/apache/hama/BSPMasterRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/BSPMasterRunner.java?rev=1004884&view=auto
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/BSPMasterRunner.java (added)
+++ incubator/hama/trunk/src/java/org/apache/hama/BSPMasterRunner.java Wed Oct  6 02:42:38
2010
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hama;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configured;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.util.Tool;
+import org.apache.hadoop.util.ToolRunner;
+import org.apache.hama.bsp.BSPMaster;
+
+public class BSPMasterRunner extends Configured implements Tool {
+
+  public static final Log LOG = LogFactory.getLog(BSPMasterRunner.class);
+
+  @Override
+  public int run(String[] args) throws Exception {
+    StringUtils.startupShutdownMessage(BSPMaster.class, args, LOG);
+
+    if (args.length != 0) {
+      System.out.println("usage: BSPMasterRunner");
+      System.exit(-1);
+    }
+
+    try {
+      HamaConfiguration conf = new HamaConfiguration(getConf());
+      BSPMaster master = BSPMaster.startMaster(conf);
+      master.offerService();
+    } catch (Throwable e) {
+      LOG.fatal(StringUtils.stringifyException(e));
+      return -1;
+    }
+    return 0;
+  }
+
+  public static void main(String[] args) throws Exception {
+    int exitCode = ToolRunner.run(new BSPMasterRunner(), args);
+    System.exit(exitCode);
+  }
+
+}

Added: incubator/hama/trunk/src/java/org/apache/hama/GroomServerRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/GroomServerRunner.java?rev=1004884&view=auto
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/GroomServerRunner.java (added)
+++ incubator/hama/trunk/src/java/org/apache/hama/GroomServerRunner.java Wed Oct  6 02:42:38
2010
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hama;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.conf.Configured;
+import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.util.Tool;
+import org.apache.hadoop.util.ToolRunner;
+import org.apache.hama.bsp.GroomServer;
+
+public class GroomServerRunner extends Configured implements Tool {
+
+  public static final Log LOG = LogFactory.getLog(GroomServerRunner.class);
+
+  @Override
+  public int run(String[] args) throws Exception {
+    StringUtils.startupShutdownMessage(GroomServer.class, args, LOG);
+
+    if (args.length != 0) {
+      System.out.println("usage: GroomServerRunner");
+      System.exit(-1);
+    }
+
+    try {
+      Configuration conf = new HamaConfiguration(getConf());
+      GroomServer groom = GroomServer.constructGroomServer(GroomServer.class,
+          conf);
+      GroomServer.startGroomServer(groom).join();
+    } catch (Throwable e) {
+      LOG.fatal(StringUtils.stringifyException(e));
+      return -1;
+    }
+
+    return 0;
+  }
+
+  public static void main(String[] args) throws Exception {
+    int exitCode = ToolRunner.run(new GroomServerRunner(), args);
+    System.exit(exitCode);
+  }
+
+}

Added: incubator/hama/trunk/src/java/org/apache/hama/ZooKeeperRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/ZooKeeperRunner.java?rev=1004884&view=auto
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/ZooKeeperRunner.java (added)
+++ incubator/hama/trunk/src/java/org/apache/hama/ZooKeeperRunner.java Wed Oct  6 02:42:38
2010
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hama;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configured;
+import org.apache.hadoop.util.Tool;
+import org.apache.hadoop.util.ToolRunner;
+import org.apache.hama.zookeeper.QuorumPeer;
+
+public class ZooKeeperRunner extends Configured implements Tool {
+
+  public static final Log LOG = LogFactory.getLog(ZooKeeperRunner.class);
+
+  @Override
+  public int run(String[] args) throws Exception {
+    QuorumPeer.run(getConf());
+    return 0;
+  }
+
+  public static void main(String[] args) throws Exception {
+    int exitCode = ToolRunner.run(new ZooKeeperRunner(), args);
+    System.exit(exitCode);
+  }
+
+}

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMaster.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMaster.java?rev=1004884&r1=1004883&r2=1004884&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMaster.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPMaster.java Wed Oct  6 02:42:38 2010
@@ -671,21 +671,4 @@ public class BSPMaster implements JobSub
     // taskid --> TIP
     taskidToTIPMap.put(taskid, taskInProgress);
   }
-
-  public static void main(String[] args) {
-    StringUtils.startupShutdownMessage(BSPMaster.class, args, LOG);
-    if (args.length != 0) {
-      System.out.println("usage: HamaMaster");
-      System.exit(-1);
-    }
-
-    try {
-      HamaConfiguration conf = new HamaConfiguration();
-      BSPMaster master = startMaster(conf);
-      master.offerService();
-    } catch (Throwable e) {
-      LOG.fatal(StringUtils.stringifyException(e));
-      System.exit(-1);
-    }
-  }
 }

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/GroomServer.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/GroomServer.java?rev=1004884&r1=1004883&r2=1004884&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/GroomServer.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/GroomServer.java Wed Oct  6 02:42:38
2010
@@ -517,24 +517,6 @@ public class GroomServer implements Runn
     }
   }
 
-  public static void main(String[] args) {
-    StringUtils.startupShutdownMessage(GroomServer.class, args, LOG);
-    if (args.length != 0) {
-      System.out.println("usage: GroomServer");
-      System.exit(-1);
-    }
-
-    try {
-      Configuration conf = new HamaConfiguration();
-      GroomServer groom = GroomServer.constructGroomServer(GroomServer.class,
-          conf);
-      startGroomServer(groom);
-    } catch (Throwable e) {
-      LOG.fatal(StringUtils.stringifyException(e));
-      System.exit(-1);
-    }
-  }
-
   public void assignTask(Task task) {
     this.task = task;
   }

Modified: incubator/hama/trunk/src/java/org/apache/hama/zookeeper/QuorumPeer.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/zookeeper/QuorumPeer.java?rev=1004884&r1=1004883&r2=1004884&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/zookeeper/QuorumPeer.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/zookeeper/QuorumPeer.java Wed Oct  6 02:42:38
2010
@@ -40,10 +40,10 @@ public class QuorumPeer implements Const
 
   /**
    * Parse ZooKeeper configuration from Hama XML config and run a QuorumPeer.
-   * @param args String[] of command line arguments. Not used.
+   * @param baseConf Hadoop Configuration.
    */
-  public static void main(String[] args) {
-    Configuration conf = new HamaConfiguration();
+  public static void run(Configuration baseConf) {
+    Configuration conf = new HamaConfiguration(baseConf);
     try {
       Properties zkProperties = makeZKProps(conf);
       writeMyID(zkProperties);



Mime
View raw message