You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by to...@apache.org on 2011/08/01 16:12:56 UTC
svn commit: r1152788 [1/9] - in /incubator/hama/trunk: ./ bin/ conf/ core/
core/bin/ core/conf/ core/src/ core/src/main/ core/src/main/java/
core/src/main/java/org/ core/src/main/java/org/apache/
core/src/main/java/org/apache/hama/ core/src/main/java/o...
Author: tommaso
Date: Mon Aug 1 14:12:46 2011
New Revision: 1152788
URL: http://svn.apache.org/viewvc?rev=1152788&view=rev
Log:
[HAMA-417] - refactoring of Maven structure: from one project to hama-parent and its modules: hama-core, hama-examples, hama-site
Added:
incubator/hama/trunk/core/ (with props)
incubator/hama/trunk/core/bin/
incubator/hama/trunk/core/bin/grooms.sh
incubator/hama/trunk/core/bin/hama
incubator/hama/trunk/core/bin/hama-config.sh
incubator/hama/trunk/core/bin/hama-daemon.sh
incubator/hama/trunk/core/bin/hama-daemons.sh
incubator/hama/trunk/core/bin/start-bspd.sh
incubator/hama/trunk/core/bin/stop-bspd.sh
incubator/hama/trunk/core/bin/zookeepers.sh
incubator/hama/trunk/core/conf/
incubator/hama/trunk/core/conf/groomservers
incubator/hama/trunk/core/conf/groomservers.template
incubator/hama/trunk/core/conf/hama-default.xml
incubator/hama/trunk/core/conf/hama-env.sh
incubator/hama/trunk/core/conf/hama-env.sh.template
incubator/hama/trunk/core/conf/hama-site.xml
incubator/hama/trunk/core/conf/hama-site.xml.template
incubator/hama/trunk/core/conf/log4j.properties
incubator/hama/trunk/core/pom.xml
incubator/hama/trunk/core/src/
incubator/hama/trunk/core/src/main/
incubator/hama/trunk/core/src/main/java/
incubator/hama/trunk/core/src/main/java/org/
incubator/hama/trunk/core/src/main/java/org/apache/
incubator/hama/trunk/core/src/main/java/org/apache/hama/
incubator/hama/trunk/core/src/main/java/org/apache/hama/BSPMasterRunner.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/Constants.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/GroomServerRunner.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/HamaConfiguration.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/MiniZooKeeperCluster.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/ZooKeeperRunner.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPInterface.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJob.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobContext.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobID.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPMaster.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPMessage.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPMessageBundle.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeer.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPPeerInterface.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPTask.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPTaskRunner.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BooleanMessage.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/ByteMessage.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/ClusterStatus.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/CommitTaskAction.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/Directive.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/DirectiveException.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/DirectiveHandler.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/DispatchTasksDirective.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/DoubleMessage.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/FCFSQueue.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/GroomServer.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/GroomServerAction.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/GroomServerManager.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/GroomServerStatus.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/ID.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/IntegerDoubleMessage.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/IntegerMessage.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/JobChangeEvent.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/JobInProgress.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/JobInProgressListener.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/JobProfile.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/JobStatus.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/KillJobAction.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/KillTaskAction.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/LaunchTaskAction.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/LocalBSPRunner.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/Messagable.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/PeerNames.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/Queue.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/QueueManager.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/ReinitGroomAction.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/ReportGroomStatusDirective.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/RunningJob.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/Schedulable.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/SimpleTaskScheduler.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/Task.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskAttemptContext.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskAttemptID.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskID.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskInProgress.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskLog.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskLogAppender.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskRunner.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskScheduler.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskStatus.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/package.html
incubator/hama/trunk/core/src/main/java/org/apache/hama/http/
incubator/hama/trunk/core/src/main/java/org/apache/hama/http/HttpServer.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/http/package.html
incubator/hama/trunk/core/src/main/java/org/apache/hama/ipc/
incubator/hama/trunk/core/src/main/java/org/apache/hama/ipc/BSPPeerProtocol.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/ipc/GroomProtocol.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/ipc/HamaRPCProtocolVersion.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/ipc/JobSubmissionProtocol.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/ipc/MasterProtocol.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/ipc/package.html
incubator/hama/trunk/core/src/main/java/org/apache/hama/package.html
incubator/hama/trunk/core/src/main/java/org/apache/hama/util/
incubator/hama/trunk/core/src/main/java/org/apache/hama/util/BSPServletUtil.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/util/Bytes.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/util/ClusterUtil.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/util/RandomVariable.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/util/RunJar.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/util/VersionInfo.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/util/package.html
incubator/hama/trunk/core/src/main/java/org/apache/hama/zookeeper/
incubator/hama/trunk/core/src/main/java/org/apache/hama/zookeeper/QuorumPeer.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/zookeeper/ZKServerTool.java
incubator/hama/trunk/core/src/main/java/org/apache/hama/zookeeper/package.html
incubator/hama/trunk/core/src/main/java/org/apache/overview.html
incubator/hama/trunk/core/src/main/resources/
incubator/hama/trunk/core/src/main/webapp/
incubator/hama/trunk/core/src/main/webapp/bspmaster/
incubator/hama/trunk/core/src/main/webapp/bspmaster/bspjob.jsp
incubator/hama/trunk/core/src/main/webapp/bspmaster/bspmaster.jsp
incubator/hama/trunk/core/src/main/webapp/bspmaster/index.html
incubator/hama/trunk/core/src/main/webapp/bspmaster/machines.jsp
incubator/hama/trunk/core/src/test/
incubator/hama/trunk/core/src/test/java/
incubator/hama/trunk/core/src/test/java/org/
incubator/hama/trunk/core/src/test/java/org/apache/
incubator/hama/trunk/core/src/test/java/org/apache/hama/
incubator/hama/trunk/core/src/test/java/org/apache/hama/HamaCluster.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/HamaClusterTestCase.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/HamaTestCase.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/MiniBSPCluster.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/
incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/TestBSPMasterGroomServer.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/TestBSPMessageBundle.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/TestClusterStatus.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/bsp/TestMessages.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/ipc/
incubator/hama/trunk/core/src/test/java/org/apache/hama/ipc/TestIPC.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/ipc/TestRPC.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/util/
incubator/hama/trunk/core/src/test/java/org/apache/hama/util/TestBytes.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/util/TestNumeric.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/util/TestRandomVariable.java
incubator/hama/trunk/core/src/test/java/org/apache/hama/zookeeper/
incubator/hama/trunk/core/src/test/java/org/apache/hama/zookeeper/TestZKTools.java
incubator/hama/trunk/core/src/test/java/testjar/
incubator/hama/trunk/core/src/test/java/testjar/ClassSerializePrinting.java
incubator/hama/trunk/core/src/test/java/testjar/testjob.jar (with props)
incubator/hama/trunk/core/src/test/resources/
incubator/hama/trunk/examples/ (with props)
incubator/hama/trunk/examples/pom.xml
incubator/hama/trunk/examples/src/
incubator/hama/trunk/examples/src/main/
incubator/hama/trunk/examples/src/main/java/
incubator/hama/trunk/examples/src/main/java/org/
incubator/hama/trunk/examples/src/main/java/org/apache/
incubator/hama/trunk/examples/src/main/java/org/apache/hama/
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/ExampleDriver.java
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/PiEstimator.java
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/RandBench.java
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/SerializePrinting.java
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/graph/
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/graph/PageRank.java
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/graph/PageRankBase.java
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/graph/PageRankVertex.java
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/graph/ShortestPathVertex.java
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/graph/ShortestPaths.java
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/graph/ShortestPathsBase.java
incubator/hama/trunk/examples/src/main/java/org/apache/hama/examples/graph/ShortestPathsGraphLoader.java
incubator/hama/trunk/site/ (with props)
incubator/hama/trunk/site/pom.xml
incubator/hama/trunk/site/src/
incubator/hama/trunk/site/src/docs/
incubator/hama/trunk/site/src/docs/forrest.properties
incubator/hama/trunk/site/src/docs/src/
incubator/hama/trunk/site/src/docs/src/documentation/
incubator/hama/trunk/site/src/docs/src/documentation/classes/
incubator/hama/trunk/site/src/docs/src/documentation/classes/CatalogManager.properties
incubator/hama/trunk/site/src/docs/src/documentation/content/
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/developers.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/docs/
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/docs/r0.2.0/
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/docs/r0.2.0/ApacheHama-0.2_UserGuide.pdf (with props)
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/docs/r0.2.0/index.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/docs/r0.3.0/
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/docs/r0.3.0/index.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/downloads.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/index.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/irc_channel.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/issue_tracking.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/mailing_lists.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/privacy_policy.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/site.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/tabs.xml
incubator/hama/trunk/site/src/docs/src/documentation/content/xdocs/who_we_are.xml
incubator/hama/trunk/site/src/docs/src/documentation/resources/
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/MapReduce.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/apache-incubator-hama-white.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/apache-incubator-hama.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/apache-incubator-logo.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/block.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/favicon.ico
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/hama_art__arthur_300x220.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/hama_art_arthur.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/hama_logo.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/hama_paint_logo.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/hama_paint_logo_120x120.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/resources/images/headerlogo.png (with props)
incubator/hama/trunk/site/src/docs/src/documentation/skinconf.xml
incubator/hama/trunk/site/src/docs/status.xml
incubator/hama/trunk/site/src/examples/
incubator/hama/trunk/site/src/examples/org/
incubator/hama/trunk/site/src/examples/org/apache/
incubator/hama/trunk/site/src/examples/org/apache/hama/
incubator/hama/trunk/site/src/examples/org/apache/hama/examples/
incubator/hama/trunk/site/src/examples/org/apache/hama/examples/graph/
incubator/hama/trunk/site/src/java/
incubator/hama/trunk/site/src/java/org/
incubator/hama/trunk/site/src/java/org/apache/
incubator/hama/trunk/site/src/java/org/apache/hama/
incubator/hama/trunk/site/src/java/org/apache/hama/bsp/
incubator/hama/trunk/site/src/java/org/apache/hama/http/
incubator/hama/trunk/site/src/java/org/apache/hama/ipc/
incubator/hama/trunk/site/src/java/org/apache/hama/util/
incubator/hama/trunk/site/src/java/org/apache/hama/zookeeper/
incubator/hama/trunk/site/src/test/
incubator/hama/trunk/site/src/test/org/
incubator/hama/trunk/site/src/test/org/apache/
incubator/hama/trunk/site/src/test/org/apache/hama/
incubator/hama/trunk/site/src/test/org/apache/hama/bsp/
incubator/hama/trunk/site/src/test/org/apache/hama/ipc/
incubator/hama/trunk/site/src/test/org/apache/hama/util/
incubator/hama/trunk/site/src/test/org/apache/hama/zookeeper/
incubator/hama/trunk/site/src/test/testjar/
incubator/hama/trunk/site/src/webapps/
incubator/hama/trunk/site/src/webapps/bspmaster/
Removed:
incubator/hama/trunk/bin/
incubator/hama/trunk/conf/
incubator/hama/trunk/src/
Modified:
incubator/hama/trunk/ (props changed)
incubator/hama/trunk/pom.xml
Propchange: incubator/hama/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Aug 1 14:12:46 2011
@@ -8,3 +8,10 @@ hama-0.1.0-dev-examples.jar
hama-0.1.0-dev-test.jar
logs
.settings
+
+lib
+target
+
+*.ipr
+
+*.iml
Propchange: incubator/hama/trunk/core/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 1 14:12:46 2011
@@ -0,0 +1,5 @@
+*.iml
+
+target
+
+lib
Added: incubator/hama/trunk/core/bin/grooms.sh
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/bin/grooms.sh?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/bin/grooms.sh (added)
+++ incubator/hama/trunk/core/bin/grooms.sh Mon Aug 1 14:12:46 2011
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# Run a shell command on all slave hosts.
+#
+# Environment Variables
+#
+# HAMA_GROOMS File naming remote hosts.
+# Default is ${HAMA_CONF_DIR}/groomservers.
+# HAMA_CONF_DIR Alternate conf dir. Default is ${HAMA_HOME}/conf.
+# HAMA_GROOM_SLEEP Seconds to sleep between spawning remote commands.
+# HAMA_SSH_OPTS Options passed to ssh when running remote commands.
+##
+
+usage="Usage: grooms.sh [--config confdir] command..."
+
+# if no args specified, show usage
+if [ $# -le 0 ]; then
+ echo $usage
+ exit 1
+fi
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/hama-config.sh
+
+# If the groomservers file is specified in the command line,
+# then it takes precedence over the definition in
+# hama-env.sh. Save it here.
+HOSTLIST=$HAMA_GROOMS
+
+if [ -f "${HAMA_CONF_DIR}/hama-env.sh" ]; then
+ . "${HAMA_CONF_DIR}/hama-env.sh"
+fi
+
+if [ "$HOSTLIST" = "" ]; then
+ if [ "$HAMA_GROOMS" = "" ]; then
+ export HOSTLIST="${HAMA_CONF_DIR}/groomservers"
+ else
+ export HOSTLIST="${HAMA_GROOMS}"
+ fi
+fi
+
+for groom in `cat "$HOSTLIST"|sed "s/#.*$//;/^$/d"`; do
+ ssh $HAMA_SSH_OPTS $groom $"${@// /\\ }" \
+ 2>&1 | sed "s/^/$groom: /" &
+ if [ "$HAMA_GROOM_SLEEP" != "" ]; then
+ sleep $HAMA_GROOM_SLEEP
+ fi
+done
+
+wait
Added: incubator/hama/trunk/core/bin/hama
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/bin/hama?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/bin/hama (added)
+++ incubator/hama/trunk/core/bin/hama Mon Aug 1 14:12:46 2011
@@ -0,0 +1,186 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# The Hama command script
+#
+# Environment Variables
+#
+# JAVA_HOME The java implementation to use. Overrides JAVA_HOME.
+#
+# HAMA_CLASSPATH Extra Java CLASSPATH entries.
+#
+# HAMA_HEAPSIZE The maximum amount of heap to use, in MB.
+# Default is 1000.
+#
+# HAMA_OPTS Extra Java runtime options.
+#
+# HAMA_NAMENODE_OPTS These options are added to HAMA_OPTS
+# HAMA_CLIENT_OPTS when the respective command is run.
+# HAMA_{COMMAND}_OPTS etc HAMA_JT_OPTS applies to JobTracker
+# for e.g. HAMA_CLIENT_OPTS applies to
+# more than one command (fs, dfs, fsck,
+# dfsadmin etc)
+#
+# HAMA_CONF_DIR Alternate conf dir. Default is ${HAMA_HOME}/conf.
+#
+# HAMA_ROOT_LOGGER The root appender. Default is INFO,console
+#
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/hama-config.sh
+
+cygwin=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+esac
+
+# if no args specified, show usage
+if [ $# = 0 ]; then
+ echo "Usage: hama [--config confdir] COMMAND"
+ echo "where COMMAND is one of:"
+ echo " bspmaster run the BSP Master node"
+ echo " groom run the Groom node"
+ echo " zookeeper run a Zookeeper server"
+ echo " job manipulate BSP jobs"
+ echo " jar <jar> run a jar file"
+ echo " or"
+ echo " CLASSNAME run the class named CLASSNAME"
+ echo "Most commands print help when invoked w/o parameters."
+ exit 1
+fi
+
+# get arguments
+COMMAND=$1
+shift
+
+if [ -f "${HAMA_CONF_DIR}/hama-env.sh" ]; then
+ . "${HAMA_CONF_DIR}/hama-env.sh"
+fi
+
+# some Java parameters
+if [ "$JAVA_HOME" != "" ]; then
+ #echo "run java in $JAVA_HOME"
+ JAVA_HOME=$JAVA_HOME
+fi
+
+if [ "$JAVA_HOME" = "" ]; then
+ echo "Error: JAVA_HOME is not set."
+ exit 1
+fi
+
+JAVA=$JAVA_HOME/bin/java
+JAVA_HEAP_MAX=-Xmx1000m
+
+# check envvars which might override default args
+if [ "$HAMA_HEAPSIZE" != "" ]; then
+ #echo "run with heapsize $HAMA_HEAPSIZE"
+ JAVA_HEAP_MAX="-Xmx""$HAMA_HEAPSIZE""m"
+ #echo $JAVA_HEAP_MAX
+fi
+
+# CLASSPATH initially contains $HAMA_CONF_DIR
+CLASSPATH="${HAMA_CONF_DIR}"
+CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar
+
+# for developers, add Hama classes to CLASSPATH
+if [ -d "$HAMA_HOME/target/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$HAMA_HOME/target/classes
+fi
+if [ -d "$HAMA_HOME/target/test-classes/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$HAMA_HOME/target/test-classes
+fi
+
+# so that filenames w/ spaces are handled correctly in loops below
+IFS=
+
+# for releases, add core hama jar to CLASSPATH
+for f in $HAMA_HOME/hama-**.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+# add libs to CLASSPATH
+for f in $HAMA_HOME/lib/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+# add user-specified CLASSPATH last
+if [ "$HAMA_CLASSPATH" != "" ]; then
+ CLASSPATH=${CLASSPATH}:${HAMA_CLASSPATH}
+fi
+
+# default log directory & file
+if [ "$HAMA_LOG_DIR" = "" ]; then
+ HAMA_LOG_DIR="$HAMA_HOME/logs"
+fi
+if [ "$HAMA_LOGFILE" = "" ]; then
+ HAMA_LOGFILE='hama.log'
+fi
+
+# default policy file for service-level authorization
+if [ "$HAMA_POLICYFILE" = "" ]; then
+ HAMA_POLICYFILE="hama-policy.xml"
+fi
+
+# restore ordinary behaviour
+unset IFS
+
+# figure out which class to run
+if [ "$COMMAND" = "bspmaster" ] ; then
+ CLASS='org.apache.hama.BSPMasterRunner'
+ BSP_OPTS="$BSP_OPTS $BSP_BSPMASTER_OPTS"
+elif [ "$COMMAND" = "groom" ] ; then
+ CLASS='org.apache.hama.GroomServerRunner'
+ BSP_OPTS="$BSP_OPTS $BSP_GROOMSERVER_OPTS"
+elif [ "$COMMAND" = "zookeeper" ] ; then
+ CLASS='org.apache.hama.ZooKeeperRunner'
+elif [ "$COMMAND" = "job" ] ; then
+ CLASS='org.apache.hama.bsp.BSPJobClient'
+elif [ "$COMMAND" = "jar" ] ; then
+ CLASS=org.apache.hama.util.RunJar
+ BSP_OPTS="$BSP_OPTS"
+else
+ CLASS=$COMMAND
+fi
+
+# cygwin path translation
+if $cygwin; then
+ CLASSPATH=`cygpath -p -w "$CLASSPATH"`
+ HAMA_HOME=`cygpath -w "$HAMA_HOME"`
+ HAMA_LOG_DIR=`cygpath -w "$HAMA_LOG_DIR"`
+ TOOL_PATH=`cygpath -p -w "$TOOL_PATH"`
+fi
+
+# cygwin path translation
+if $cygwin; then
+ JAVA_LIBRARY_PATH=`cygpath -p "$JAVA_LIBRARY_PATH"`
+fi
+
+HAMA_OPTS="$HAMA_OPTS -Dhama.log.dir=$HAMA_LOG_DIR"
+HAMA_OPTS="$HAMA_OPTS -Dhama.log.file=$HAMA_LOGFILE"
+HAMA_OPTS="$HAMA_OPTS -Dhama.home.dir=$HAMA_HOME"
+HAMA_OPTS="$HAMA_OPTS -Dhama.id.str=$HAMA_IDENT_STRING"
+HAMA_OPTS="$HAMA_OPTS -Dhama.root.logger=${HAMA_ROOT_LOGGER:-INFO,console}"
+if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
+ HAMA_OPTS="$HAMA_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
+fi
+HAMA_OPTS="$HAMA_OPTS -Dhama.policy.file=$HAMA_POLICYFILE"
+
+# run it
+exec "$JAVA" $JAVA_HEAP_MAX $HAMA_OPTS -classpath "$CLASSPATH" $CLASS "$@"
Added: incubator/hama/trunk/core/bin/hama-config.sh
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/bin/hama-config.sh?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/bin/hama-config.sh (added)
+++ incubator/hama/trunk/core/bin/hama-config.sh Mon Aug 1 14:12:46 2011
@@ -0,0 +1,74 @@
+# 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.
+
+# included in all the hama scripts with source command
+# should not be executable directly
+# also should not be passed any arguments, since we need original $*
+
+# resolve links - $0 may be a softlink
+
+this="$0"
+while [ -h "$this" ]; do
+ ls=`ls -ld "$this"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ this="$link"
+ else
+ this=`dirname "$this"`/"$link"
+ fi
+done
+
+# convert relative path to absolute path
+bin=`dirname "$this"`
+script=`basename "$this"`
+bin=`cd "$bin"; pwd`
+this="$bin/$script"
+
+# the root of the Hama installation
+export HAMA_HOME=`dirname "$this"`/..
+
+#check to see if the conf dir is given as an optional argument
+if [ $# -gt 1 ]
+then
+ if [ "--config" = "$1" ]
+ then
+ shift
+ confdir=$1
+ shift
+ HAMA_CONF_DIR=$confdir
+ fi
+fi
+
+# Allow alternate conf dir location.
+HAMA_CONF_DIR="${HAMA_CONF_DIR:-$HAMA_HOME/conf}"
+
+# Source the hama-env.sh.
+# Will have JAVA_HOME and HAMA_MANAGES_ZK defined.
+if [ -f "${HAMA_CONF_DIR}/hama-env.sh" ]; then
+ . "${HAMA_CONF_DIR}/hama-env.sh"
+fi
+
+#check to see it is specified whether to use the grooms or the
+# masters file
+if [ $# -gt 1 ]
+then
+ if [ "--hosts" = "$1" ]
+ then
+ shift
+ grooms=$1
+ shift
+ export HAMA_SLAVES="${HAMA_CONF_DIR}/$grooms"
+ fi
+fi
Added: incubator/hama/trunk/core/bin/hama-daemon.sh
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/bin/hama-daemon.sh?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/bin/hama-daemon.sh (added)
+++ incubator/hama/trunk/core/bin/hama-daemon.sh Mon Aug 1 14:12:46 2011
@@ -0,0 +1,141 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# Runs a Hama command as a daemon.
+#
+# Environment Variables
+#
+# HAMA_CONF_DIR Alternate conf dir. Default is ${HAMA_HOME}/conf.
+# HAMA_LOG_DIR Where log files are stored. PWD by default.
+# HAMA_MASTER host:path where hama code should be rsync'd from
+# HAMA_PID_DIR The pid files are stored. /tmp by default.
+# HAMA_IDENT_STRING A string representing this instance of hama. $USER by default
+# HAMA_NICENESS The scheduling priority for daemons. Defaults to 0.
+##
+
+usage="Usage: hama-daemon.sh [--config <conf-dir>] [--hosts hostlistfile] (start|stop) <hama-command> <args...>"
+
+# if no args specified, show usage
+if [ $# -le 1 ]; then
+ echo $usage
+ exit 1
+fi
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/hama-config.sh
+
+# get arguments
+startStop=$1
+shift
+command=$1
+shift
+
+hama_rotate_log ()
+{
+ log=$1;
+ num=5;
+ if [ -n "$2" ]; then
+ num=$2
+ fi
+ if [ -f "$log" ]; then # rotate logs
+ while [ $num -gt 1 ]; do
+ prev=`expr $num - 1`
+ [ -f "$log.$prev" ] && mv "$log.$prev" "$log.$num"
+ num=$prev
+ done
+ mv "$log" "$log.$num";
+ fi
+}
+
+if [ -f "${HAMA_CONF_DIR}/hama-env.sh" ]; then
+ . "${HAMA_CONF_DIR}/hama-env.sh"
+fi
+
+# get log directory
+if [ "$HAMA_LOG_DIR" = "" ]; then
+ export HAMA_LOG_DIR="$HAMA_HOME/logs"
+fi
+mkdir -p "$HAMA_LOG_DIR"
+
+if [ "$HAMA_PID_DIR" = "" ]; then
+ HAMA_PID_DIR=/tmp
+fi
+
+if [ "$HAMA_IDENT_STRING" = "" ]; then
+ export HAMA_IDENT_STRING="$USER"
+fi
+
+# some variables
+export HAMA_LOGFILE=hama-$HAMA_IDENT_STRING-$command-$HOSTNAME.log
+export HAMA_ROOT_LOGGER="INFO,DRFA"
+log=$HAMA_LOG_DIR/hama-$HAMA_IDENT_STRING-$command-$HOSTNAME.out
+pid=$HAMA_PID_DIR/hama-$HAMA_IDENT_STRING-$command.pid
+
+# Set default scheduling priority
+if [ "$HAMA_NICENESS" = "" ]; then
+ export HAMA_NICENESS=0
+fi
+
+case $startStop in
+
+ (start)
+
+ mkdir -p "$HAMA_PID_DIR"
+
+ if [ -f $pid ]; then
+ if kill -0 `cat $pid` > /dev/null 2>&1; then
+ echo $command running as process `cat $pid`. Stop it first.
+ exit 1
+ fi
+ fi
+
+ if [ "$HAMA_MASTER" != "" ]; then
+ echo rsync from $HAMA_MASTER
+ rsync -a -e ssh --delete --exclude=.svn --exclude='logs/*' --exclude='contrib/hod/logs/*' $HAMA_MASTER/ "$HAMA_HOME"
+ fi
+
+ hama_rotate_log $log
+ echo starting $command, logging to $log
+ cd "$HAMA_HOME"
+ nohup nice -n $HAMA_NICENESS "$HAMA_HOME"/bin/hama --config $HAMA_CONF_DIR $command "$@" > "$log" 2>&1 < /dev/null &
+ echo $! > $pid
+ sleep 1; head "$log"
+ ;;
+
+ (stop)
+
+ if [ -f $pid ]; then
+ if kill -0 `cat $pid` > /dev/null 2>&1; then
+ echo stopping $command
+ kill `cat $pid`
+ else
+ echo no $command to stop
+ fi
+ else
+ echo no $command to stop
+ fi
+ ;;
+
+ (*)
+ echo $usage
+ exit 1
+ ;;
+
+esac
Added: incubator/hama/trunk/core/bin/hama-daemons.sh
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/bin/hama-daemons.sh?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/bin/hama-daemons.sh (added)
+++ incubator/hama/trunk/core/bin/hama-daemons.sh Mon Aug 1 14:12:46 2011
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# Run a Hama command on all slave hosts.
+
+usage="Usage: hama-daemons.sh [--config confdir] [--hosts hostlistfile] [start|stop] command args..."
+
+# if no args specified, show usage
+if [ $# -le 1 ]; then
+ echo $usage
+ exit 1
+fi
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. $bin/hama-config.sh
+
+remote_cmd="cd ${HAMA_HOME}; $bin/hama-daemon.sh --config ${HAMA_CONF_DIR} $@"
+args="--config ${HAMA_CONF_DIR} $remote_cmd"
+command=$2
+
+case $command in
+ (zookeeper)
+ exec "$bin/zookeepers.sh" $args
+ ;;
+ (*)
+ exec "$bin/grooms.sh" $args
+ ;;
+esac
\ No newline at end of file
Added: incubator/hama/trunk/core/bin/start-bspd.sh
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/bin/start-bspd.sh?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/bin/start-bspd.sh (added)
+++ incubator/hama/trunk/core/bin/start-bspd.sh Mon Aug 1 14:12:46 2011
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# Start hama map reduce daemons. Run this on master node.
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/hama-config.sh
+
+# start bsp daemons
+# start zookeeper first to minimize connection errors at startup
+"$bin"/hama-daemons.sh --config "${HAMA_CONF_DIR}" start zookeeper
+"$bin"/hama-daemon.sh --config $HAMA_CONF_DIR start bspmaster
+"$bin"/hama-daemons.sh --config $HAMA_CONF_DIR start groom
Added: incubator/hama/trunk/core/bin/stop-bspd.sh
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/bin/stop-bspd.sh?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/bin/stop-bspd.sh (added)
+++ incubator/hama/trunk/core/bin/stop-bspd.sh Mon Aug 1 14:12:46 2011
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+# Stop hama map reduce daemons. Run this on master node.
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/hama-config.sh
+
+"$bin"/hama-daemon.sh --config $HAMA_CONF_DIR stop bspmaster
+"$bin"/hama-daemons.sh --config $HAMA_CONF_DIR stop groom
+"$bin"/hama-daemons.sh --config "${HAMA_CONF_DIR}" stop zookeeper
Added: incubator/hama/trunk/core/bin/zookeepers.sh
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/bin/zookeepers.sh?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/bin/zookeepers.sh (added)
+++ incubator/hama/trunk/core/bin/zookeepers.sh Mon Aug 1 14:12:46 2011
@@ -0,0 +1,57 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Copyright 2009 The Apache Software Foundation
+# *
+# * 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.
+# */
+#
+# Run a shell command on all zookeeper hosts.
+#
+# Environment Variables
+#
+# HAMA_CONF_DIR Alternate hama conf dir. Default is ${HAMA_HOME}/conf.
+# HAMA_SSH_OPTS Options passed to ssh when running remote commands.
+#
+# Modelled after $HADOOP_HOME/bin/slaves.sh.
+
+usage="Usage: zookeepers [--config <hama-confdir>] command..."
+
+# if no args specified, show usage
+if [ $# -le 0 ]; then
+ echo $usage
+ exit 1
+fi
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/hama-config.sh
+
+if [ "$HAMA_MANAGES_ZK" = "" ]; then
+ HAMA_MANAGES_ZK=true
+fi
+
+if [ "$HAMA_MANAGES_ZK" = "true" ]; then
+ hosts=`"$bin"/hama org.apache.hama.zookeeper.ZKServerTool`
+ cmd=$"${@// /\\ }"
+ for zookeeper in $hosts; do
+ ssh $HAMA_SSH_OPTS $zookeeper $cmd 2>&1 | sed "s/^/$zookeeper: /" &
+ done
+fi
+
+wait
Added: incubator/hama/trunk/core/conf/groomservers
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/conf/groomservers?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/conf/groomservers (added)
+++ incubator/hama/trunk/core/conf/groomservers Mon Aug 1 14:12:46 2011
@@ -0,0 +1 @@
+localhost
\ No newline at end of file
Added: incubator/hama/trunk/core/conf/groomservers.template
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/conf/groomservers.template?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/conf/groomservers.template (added)
+++ incubator/hama/trunk/core/conf/groomservers.template Mon Aug 1 14:12:46 2011
@@ -0,0 +1 @@
+localhost
\ No newline at end of file
Added: incubator/hama/trunk/core/conf/hama-default.xml
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/conf/hama-default.xml?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/conf/hama-default.xml (added)
+++ incubator/hama/trunk/core/conf/hama-default.xml Mon Aug 1 14:12:46 2011
@@ -0,0 +1,165 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Copyright 2009 The Apache Software Foundation
+ *
+ * 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.
+ */
+-->
+<configuration>
+ <property>
+ <name>bsp.master.address</name>
+ <value>local</value>
+ <description>The address of the bsp master server. Either the
+ literal string "local" or a host[:port] (where host is a name or
+ IP address) for distributed mode.
+ </description>
+ </property>
+ <property>
+ <name>bsp.master.port</name>
+ <value>40000</value>
+ <description>The port master should bind to.</description>
+ </property>
+ <property>
+ <name>bsp.peer.port</name>
+ <value>61000</value>
+ <description>The port an groom server binds to.</description>
+ </property>
+ <property>
+ <name>bsp.groom.rpc.port</name>
+ <value>50000</value>
+ <description>The port an groom rpc binds to.</description>
+ </property>
+ <property>
+ <name>bsp.http.infoserver.port</name>
+ <value>40013</value>
+ <description>The port where the web-interface can be seen.
+ </description>
+ </property>
+ <property>
+ <name>bsp.groom.report.address</name>
+ <value>127.0.0.1:0</value>
+ <description>The interface and port that groom server listens on.
+ Since it is only connected to by the tasks, it uses the local interface.
+ EXPERT ONLY. Should only be changed if your host does not have the loopback
+ interface.</description>
+ </property>
+ <property>
+ <name>bsp.system.dir</name>
+ <value>${hadoop.tmp.dir}/bsp/system</value>
+ <description>The shared directory where BSP stores control files.
+ </description>
+ </property>
+ <property>
+ <name>bsp.local.dir</name>
+ <value>${hadoop.tmp.dir}/bsp/local</value>
+ <description>local directory for temporal store.</description>
+ </property>
+ <property>
+ <name>hama.tmp.dir</name>
+ <value>/tmp/hama-${user.name}</value>
+ <description>Temporary directory on the local filesystem.</description>
+ </property>
+ <property>
+ <name>bsp.child.java.opts</name>
+ <value>-Xmx1024m</value>
+ <description>Java opts for the groom server child processes.
+ The following symbol, if present, will be interpolated: @taskid@ is replaced
+ by current TaskID. Any other occurrences of '@' will go unchanged.
+ For example, to enable verbose gc logging to a file named for the taskid in
+ /tmp and to set the heap maximum to be a gigabyte, pass a 'value' of:
+ -Xmx1024m -verbose:gc -Xloggc:/tmp/@taskid@.gc
+ The configuration variable bsp.child.ulimit can be used to control the
+ maximum virtual memory of the child processes.
+ </description>
+ </property>
+ <property>
+ <name>bsp.local.tasks.maximum</name>
+ <value>20</value>
+ <description>Number of tasks that run in parallel when in local mode.</description>
+ </property>
+
+ <!--
+ Beginning of properties that are directly mapped from ZooKeeper's zoo.cfg.
+ All properties with an "hama.zookeeper.property." prefix are converted for
+ ZooKeeper's configuration. Hence, if you want to add an option from zoo.cfg,
+ e.g. "initLimit=10" you would append the following to your configuration:
+ <property>
+ <name>hama.zookeeper.property.initLimit</name>
+ <value>10</value>
+ </property>
+ -->
+ <property>
+ <name>hama.zookeeper.property.initLimit</name>
+ <value>10</value>
+ <description>Property from ZooKeeper's config zoo.cfg.
+ The number of ticks that the initial synchronization phase can take.
+ </description>
+ </property>
+ <property>
+ <name>hama.zookeeper.property.syncLimit</name>
+ <value>5</value>
+ <description>Property from ZooKeeper's config zoo.cfg.
+ The number of ticks that can pass between sending a request and getting an
+ acknowledgment.
+ </description>
+ </property>
+ <property>
+ <name>hama.zookeeper.property.dataDir</name>
+ <value>${hama.tmp.dir}/zookeeper</value>
+ <description>Property from ZooKeeper's config zoo.cfg.
+ The directory where the snapshot is stored.
+ </description>
+ </property>
+ <property>
+ <name>hama.zookeeper.property.clientPort</name>
+ <value>21810</value>
+ <description>Property from ZooKeeper's config zoo.cfg.
+ The port at which the clients will connect.
+ </description>
+ </property>
+ <property>
+ <name>hama.zookeeper.property.tickTime</name>
+ <value>3000</value>
+ <description></description>
+ </property>
+ <property>
+ <name>hama.zookeeper.property.maxClientCnxns</name>
+ <value>30</value>
+ <description>Property from ZooKeeper's config zoo.cfg.
+ Limit on number of concurrent connections (at the socket level) that a
+ single client, identified by IP address, may make to a single member of
+ the ZooKeeper ensemble. Set high to avoid zk connection issues running
+ standalone and pseudo-distributed.
+ </description>
+ </property>
+
+ <property>
+ <name>hama.zookeeper.quorum</name>
+ <value>localhost</value>
+ <description>Comma separated list of servers in the ZooKeeper quorum.
+ For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".
+ By default this is set to localhost for local and pseudo-distributed modes
+ of operation. For a fully-distributed setup, this should be set to a full
+ list of ZooKeeper quorum servers. If HAMA_MANAGES_ZK is set in hama-env.sh
+ this is the list of servers which we will start/stop ZooKeeper on.
+ </description>
+ </property>
+
+ <!-- End of properties that are directly mapped from ZooKeeper's zoo.cfg -->
+</configuration>
Added: incubator/hama/trunk/core/conf/hama-env.sh
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/conf/hama-env.sh?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/conf/hama-env.sh (added)
+++ incubator/hama/trunk/core/conf/hama-env.sh Mon Aug 1 14:12:46 2011
@@ -0,0 +1,34 @@
+#
+#/**
+# * Copyright 2007 The Apache Software Foundation
+# *
+# * 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.
+# */
+
+# Set environment variables here.
+
+# The java implementation to use. Required.
+# export JAVA_HOME=/usr/lib/jvm/java-6-sun
+
+# Where log files are stored. $HAMA_HOME/logs by default.
+# export HAMA_LOG_DIR=${HAMA_HOME}/logs
+
+# Extra ssh options. Empty by default.
+# export HAMA_SSH_OPTS="-o ConnectTimeout=1 -o SendEnv=HAMA_CONF_DIR"
+
+# Tell Hama whether it should manage it's own instance of Zookeeper or not.
+# export HAMA_MANAGES_ZK=true
Added: incubator/hama/trunk/core/conf/hama-env.sh.template
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/conf/hama-env.sh.template?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/conf/hama-env.sh.template (added)
+++ incubator/hama/trunk/core/conf/hama-env.sh.template Mon Aug 1 14:12:46 2011
@@ -0,0 +1,37 @@
+#
+#/**
+# * Copyright 2007 The Apache Software Foundation
+# *
+# * 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.
+# */
+
+# Set environment variables here.
+
+# The java implementation to use. Required.
+# export JAVA_HOME=/usr/lib/jvm/java-6-sun
+
+# Where log files are stored. $HAMA_HOME/logs by default.
+# export HAMA_LOG_DIR=${HAMA_HOME}/logs
+
+# The maximum amount of heap to use, in MB. Default is 1000.
+# export HAMA_HEAPSIZE=1000
+
+# Extra ssh options. Empty by default.
+# export HAMA_SSH_OPTS="-o ConnectTimeout=1 -o SendEnv=HAMA_CONF_DIR"
+
+# Tell Hama whether it should manage it's own instance of Zookeeper or not.
+# export HAMA_MANAGES_ZK=true
Added: incubator/hama/trunk/core/conf/hama-site.xml
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/conf/hama-site.xml?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/conf/hama-site.xml (added)
+++ incubator/hama/trunk/core/conf/hama-site.xml Mon Aug 1 14:12:46 2011
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * 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.
+ */
+-->
+<configuration>
+</configuration>
Added: incubator/hama/trunk/core/conf/hama-site.xml.template
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/conf/hama-site.xml.template?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/conf/hama-site.xml.template (added)
+++ incubator/hama/trunk/core/conf/hama-site.xml.template Mon Aug 1 14:12:46 2011
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * 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.
+ */
+-->
+<configuration>
+</configuration>
Added: incubator/hama/trunk/core/conf/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/conf/log4j.properties?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/conf/log4j.properties (added)
+++ incubator/hama/trunk/core/conf/log4j.properties Mon Aug 1 14:12:46 2011
@@ -0,0 +1,81 @@
+#
+# 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.
+#
+
+# Define some default values that can be overridden by system properties
+hama.root.logger=INFO,console
+hama.log.dir=.
+hama.log.file=hama.log
+
+# Define the root logger to the system property "hama.root.logger".
+log4j.rootLogger=${hama.root.logger}
+
+# Logging Threshold
+log4j.threshhold=ALL
+
+#
+# Daily Rolling File Appender
+#
+log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.DRFA.File=${hama.log.dir}/${hama.log.file}
+
+# Rollver at midnight
+log4j.appender.DRFA.DatePattern=.yyyy-MM-dd
+
+# 30-day backup
+#log4j.appender.DRFA.MaxBackupIndex=30
+log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
+
+# Pattern format: Date LogLevel LoggerName LogMessage
+log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
+
+# Debugging Pattern format
+#log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
+
+#
+# TaskLog Appender
+#
+
+#Default values
+hama.tasklog.taskid=null
+hama.tasklog.noKeepSplits=4
+hama.tasklog.totalLogFileSize=100
+hama.tasklog.purgeLogSplits=true
+hama.tasklog.logsRetainHours=12
+
+log4j.appender.TLA=org.apache.hama.bsp.TaskLogAppender
+log4j.appender.TLA.taskId=${hama.tasklog.taskid}
+log4j.appender.TLA.totalLogFileSize=${hama.tasklog.totalLogFileSize}
+
+log4j.appender.TLA.layout=org.apache.log4j.PatternLayout
+log4j.appender.TLA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
+
+#
+# console
+# Add "console" to rootlogger above if you want to use this
+#
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.target=System.err
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
+
+# Custom Logging levels
+
+#log4j.logger.org.apache.hadoop.fs.FSNamesystem=DEBUG
+#log4j.logger.org.apache.hadoop.dfs=DEBUG
+#log4j.logger.org.apache.hama=DEBUG
Added: incubator/hama/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/pom.xml?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/pom.xml (added)
+++ incubator/hama/trunk/core/pom.xml Mon Aug 1 14:12:46 2011
@@ -0,0 +1,127 @@
+<!--
+ 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.hama</groupId>
+ <artifactId>hama-parent</artifactId>
+ <version>0.4.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.hama</groupId>
+ <artifactId>hama-core</artifactId>
+ <name>Apache Hama Core</name>
+ <version>0.4.0-incubating-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <scm>
+ <connection>
+ scm:svn:http://svn.apache.org/repos/asf/incubator/hama/core
+ </connection>
+ <developerConnection>
+ scm:svn:https://svn.apache.org/repos/asf/incubator/hama/core
+ </developerConnection>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-api-2.1</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-2.1</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>zookeeper</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/target/lib</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <finalName>hama-core-${project.version}</finalName>
+ </build>
+</project>
Added: incubator/hama/trunk/core/src/main/java/org/apache/hama/BSPMasterRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/BSPMasterRunner.java?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/src/main/java/org/apache/hama/BSPMasterRunner.java (added)
+++ incubator/hama/trunk/core/src/main/java/org/apache/hama/BSPMasterRunner.java Mon Aug 1 14:12:46 2011
@@ -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.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;
+
+/**
+ * This class starts and runs the 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/core/src/main/java/org/apache/hama/Constants.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/Constants.java?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/src/main/java/org/apache/hama/Constants.java (added)
+++ incubator/hama/trunk/core/src/main/java/org/apache/hama/Constants.java Mon Aug 1 14:12:46 2011
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * 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;
+
+/**
+ * Some constants used in the Hama.
+ */
+public interface Constants {
+
+ public static final String GROOM_RPC_HOST = "bsp.groom.rpc.hostname";
+
+ public static final String DEFAULT_GROOM_RPC_HOST = "0.0.0.0";
+
+ public static final String GROOM_RPC_PORT = "bsp.groom.rpc.port";
+
+ /** Default port region rpc server listens on. */
+ public static final int DEFAULT_GROOM_RPC_PORT = 50000;
+
+
+ ///////////////////////////////////////
+ // Constants for BSP Package
+ ///////////////////////////////////////
+ /** default host address */
+ public static final String PEER_HOST = "bsp.peer.hostname";
+ /** default host address */
+ public static final String DEFAULT_PEER_HOST = "0.0.0.0";
+
+ public static final String PEER_PORT = "bsp.peer.port";
+ /** Default port region server listens on. */
+ public static final int DEFAULT_PEER_PORT = 61000;
+
+ public static final String PEER_ID = "bsp.peer.id";
+
+ /** Parameter name for what groom server implementation to use. */
+ public static final String GROOM_SERVER_IMPL= "hama.groomserver.impl";
+
+ /** When we encode strings, we always specify UTF8 encoding */
+ static final String UTF8_ENCODING = "UTF-8";
+
+ ///////////////////////////////////////
+ // Constants for ZooKeeper
+ ///////////////////////////////////////
+ /** zookeeper root */
+ public static final String ZOOKEEPER_ROOT = "bsp.zookeeper.root";
+ /** zookeeper default root */
+ public static final String DEFAULT_ZOOKEEPER_ROOT = "/bsp";
+
+ /** zookeeper server address */
+ public static final String ZOOKEEPER_SERVER_ADDRS = "zookeeper.server";
+ /** zookeeper default server address */
+ static final String DEFAULT_ZOOKEEPER_SERVER_ADDR = "localhost:21810";
+ /** Parameter name for number of times to retry writes to ZooKeeper. */
+ public static final String ZOOKEEPER_RETRIES = "zookeeper.retries";
+ /** Default number of times to retry writes to ZooKeeper. */
+ public static final int DEFAULT_ZOOKEEPER_RETRIES = 5;
+ /** Parameter name for ZooKeeper pause between retries. In milliseconds. */
+ public static final String ZOOKEEPER_PAUSE = "zookeeper.pause";
+ /** Default ZooKeeper pause value. In milliseconds. */
+ public static final int DEFAULT_ZOOKEEPER_PAUSE = 2 * 1000;
+
+ static final String ZOOKEEPER_CONFIG_NAME = "zoo.cfg";
+ static final String ZOOKEEPER_CLIENT_PORT = "hama.zookeeper.property.clientPort";
+ static final String ZOOKEEPER_SESSION_TIMEOUT = "hama.zookeeper.session.timeout";
+ static final int DEFAULT_ZOOKEEPER_CLIENT_PORT = 21810;
+ static final String ZOOKEEPER_QUORUM = "hama.zookeeper.quorum";
+ /** Cluster is in distributed mode or not */
+ static final String CLUSTER_DISTRIBUTED = "hama.cluster.distributed";
+ /** Cluster is fully-distributed */
+ static final String CLUSTER_IS_DISTRIBUTED = "true";
+
+
+ // Other constants
+
+ /**
+ * An empty instance.
+ */
+ static final byte [] EMPTY_BYTE_ARRAY = new byte [0];
+}
Added: incubator/hama/trunk/core/src/main/java/org/apache/hama/GroomServerRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/GroomServerRunner.java?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/src/main/java/org/apache/hama/GroomServerRunner.java (added)
+++ incubator/hama/trunk/core/src/main/java/org/apache/hama/GroomServerRunner.java Mon Aug 1 14:12:46 2011
@@ -0,0 +1,63 @@
+/**
+ * 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;
+
+/**
+ * This class starts and runs the 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/core/src/main/java/org/apache/hama/HamaConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/HamaConfiguration.java?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/src/main/java/org/apache/hama/HamaConfiguration.java (added)
+++ incubator/hama/trunk/core/src/main/java/org/apache/hama/HamaConfiguration.java Mon Aug 1 14:12:46 2011
@@ -0,0 +1,61 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * 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 java.util.Map.Entry;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+
+/**
+ * Adds Hama configuration files to a Configuration.
+ */
+public class HamaConfiguration extends Configuration {
+ /** constructor */
+ public HamaConfiguration() {
+ super();
+ addHamaResources();
+ }
+
+ public HamaConfiguration(Path confFile) {
+ super();
+ this.addResource(confFile);
+ }
+
+ /**
+ * Create a clone of passed configuration.
+ *
+ * @param c Configuration to clone.
+ */
+ public HamaConfiguration(final Configuration c) {
+ this();
+ for (Entry<String, String> e : c) {
+ set(e.getKey(), e.getValue());
+ }
+ }
+
+ /**
+ * Adds Hama configuration files to a Configuration
+ */
+ private void addHamaResources() {
+ Configuration.addDefaultResource("hama-default.xml");
+ Configuration.addDefaultResource("hama-site.xml");
+ }
+}
Added: incubator/hama/trunk/core/src/main/java/org/apache/hama/MiniZooKeeperCluster.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/MiniZooKeeperCluster.java?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/src/main/java/org/apache/hama/MiniZooKeeperCluster.java (added)
+++ incubator/hama/trunk/core/src/main/java/org/apache/hama/MiniZooKeeperCluster.java Mon Aug 1 14:12:46 2011
@@ -0,0 +1,216 @@
+/**
+ * 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 java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.net.BindException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.fs.FileUtil;
+import org.apache.zookeeper.server.NIOServerCnxn;
+import org.apache.zookeeper.server.ZooKeeperServer;
+import org.apache.zookeeper.server.persistence.FileTxnLog;
+
+/**
+ * This class starts and runs the MiniZookeeperCluster.
+ */
+public class MiniZooKeeperCluster {
+ private static final Log LOG = LogFactory.getLog(MiniZooKeeperCluster.class);
+
+ private static final int TICK_TIME = 2000;
+ private static final int CONNECTION_TIMEOUT = 30000;
+
+ private boolean started;
+ private int clientPort = 21810; // use non-standard port
+
+ private NIOServerCnxn.Factory standaloneServerFactory;
+ private int tickTime = 0;
+
+ /** Create mini Zookeeper cluster. */
+ public MiniZooKeeperCluster() {
+ this.started = false;
+ }
+
+ public void setClientPort(int clientPort) {
+ this.clientPort = clientPort;
+ }
+
+ public void setTickTime(int tickTime) {
+ this.tickTime = tickTime;
+ }
+
+ private static void setupTestEnv() {
+ // during the tests we run with 100K prealloc in the logs.
+ // on windows systems prealloc of 64M was seen to take ~15seconds
+ // resulting in test failure (client timeout on first session).
+ // set env and directly in order to handle static init/gc issues
+ System.setProperty("zookeeper.preAllocSize", "100");
+ FileTxnLog.setPreallocSize(100);
+ }
+
+ /**
+ * @param baseDir
+ * @return ClientPort server bound to.
+ * @throws IOException
+ * @throws InterruptedException
+ */
+ public int startup(File baseDir) throws IOException,
+ InterruptedException {
+
+ setupTestEnv();
+
+ shutdown();
+
+ File dir = new File(baseDir, "zookeeper").getAbsoluteFile();
+ recreateDir(dir);
+
+ int tickTimeToUse;
+ if (this.tickTime > 0) {
+ tickTimeToUse = this.tickTime;
+ } else {
+ tickTimeToUse = TICK_TIME;
+ }
+ ZooKeeperServer server = new ZooKeeperServer(dir, dir, tickTimeToUse);
+ while (true) {
+ try {
+ standaloneServerFactory =
+ new NIOServerCnxn.Factory(new InetSocketAddress(clientPort));
+ } catch (BindException e) {
+ LOG.info("Faild binding ZK Server to client port: " + clientPort);
+ //this port is already in use. try to use another
+ clientPort++;
+ continue;
+ }
+ break;
+ }
+ standaloneServerFactory.startup(server);
+
+ if (!waitForServerUp(clientPort, CONNECTION_TIMEOUT)) {
+ throw new IOException("Waiting for startup of standalone server");
+ }
+
+ started = true;
+
+ return clientPort;
+ }
+
+ private void recreateDir(File dir) throws IOException {
+ if (dir.exists()) {
+ FileUtil.fullyDelete(dir);
+ }
+ try {
+ dir.mkdirs();
+ } catch (SecurityException e) {
+ throw new IOException("creating dir: " + dir, e);
+ }
+ }
+
+ /**
+ * @throws IOException
+ */
+ public void shutdown() throws IOException {
+ if (!started) {
+ return;
+ }
+
+ standaloneServerFactory.shutdown();
+ if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) {
+ throw new IOException("Waiting for shutdown of standalone server");
+ }
+
+ started = false;
+ }
+
+ // XXX: From o.a.zk.t.ClientBase
+ private static boolean waitForServerDown(int port, long timeout) {
+ long start = System.currentTimeMillis();
+ while (true) {
+ try {
+ Socket sock = new Socket("localhost", port);
+ try {
+ OutputStream outstream = sock.getOutputStream();
+ outstream.write("stat".getBytes());
+ outstream.flush();
+ } finally {
+ sock.close();
+ }
+ } catch (IOException e) {
+ return true;
+ }
+
+ if (System.currentTimeMillis() > start + timeout) {
+ break;
+ }
+ try {
+ Thread.sleep(250);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ return false;
+ }
+
+ // XXX: From o.a.zk.t.ClientBase
+ private static boolean waitForServerUp(int port, long timeout) {
+ long start = System.currentTimeMillis();
+ while (true) {
+ try {
+ Socket sock = new Socket("localhost", port);
+ BufferedReader reader = null;
+ try {
+ OutputStream outstream = sock.getOutputStream();
+ outstream.write("stat".getBytes());
+ outstream.flush();
+
+ Reader isr = new InputStreamReader(sock.getInputStream());
+ reader = new BufferedReader(isr);
+ String line = reader.readLine();
+ if (line != null && line.startsWith("Zookeeper version:")) {
+ return true;
+ }
+ } finally {
+ sock.close();
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ } catch (IOException e) {
+ // ignore as this is expected
+ LOG.info("server localhost:" + port + " not up " + e);
+ }
+
+ if (System.currentTimeMillis() > start + timeout) {
+ break;
+ }
+ try {
+ Thread.sleep(250);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ return false;
+ }
+}
Added: incubator/hama/trunk/core/src/main/java/org/apache/hama/ZooKeeperRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/ZooKeeperRunner.java?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/src/main/java/org/apache/hama/ZooKeeperRunner.java (added)
+++ incubator/hama/trunk/core/src/main/java/org/apache/hama/ZooKeeperRunner.java Mon Aug 1 14:12:46 2011
@@ -0,0 +1,45 @@
+/**
+ * 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;
+
+/**
+ * This class starts and runs the ZooKeeperServer.
+ */
+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);
+ }
+
+}
Added: incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java (added)
+++ incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSP.java Mon Aug 1 14:12:46 2011
@@ -0,0 +1,24 @@
+/**
+ * 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.bsp;
+
+/**
+ * This class provides an abstract implementation of the BSP interface.
+ */
+public abstract class BSP implements BSPInterface {
+}
Added: incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPInterface.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPInterface.java?rev=1152788&view=auto
==============================================================================
--- incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPInterface.java (added)
+++ incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPInterface.java Mon Aug 1 14:12:46 2011
@@ -0,0 +1,44 @@
+/**
+ * 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.bsp;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configurable;
+import org.apache.zookeeper.KeeperException;
+
+/**
+ * Interface BSP defines the basic operations needed to implement the BSP
+ * algorithm.
+ */
+public interface BSPInterface extends Configurable {
+
+ /**
+ * A user defined function for programming in the BSP style.
+ *
+ * Applications can use the {@link org.apache.hama.bsp.BSPPeer} to handle the
+ * communication and synchronization between processors.
+ *
+ * @param bspPeer
+ * @throws IOException
+ * @throws KeeperException
+ * @throws InterruptedException
+ */
+ public void bsp(BSPPeer bspPeer) throws IOException, KeeperException,
+ InterruptedException;
+}