Added: hadoop/mapreduce/branches/MR-279/yarn/bin/yarn
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/bin/yarn?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/bin/yarn (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/bin/yarn Thu Mar 17 20:21:13 2011
@@ -0,0 +1,341 @@
+#!/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 Hadoop command script
+#
+# Environment Variables
+#
+# JAVA_HOME The java implementation to use. Overrides JAVA_HOME.
+#
+# YARN_CLASSPATH Extra Java CLASSPATH entries.
+#
+# YARN_USER_CLASSPATH_FIRST When defined, the YARN_CLASSPATH is
+# added in the beginning of the global
+# classpath. Can be defined, for example,
+# by doing
+# export YARN_USER_CLASSPATH_FIRST=true
+#
+# YARN_HEAPSIZE The maximum amount of heap to use, in MB.
+# Default is 1000.
+#
+# YARN_OPTS Extra Java runtime options.
+#
+# YARN_NAMENODE_OPTS These options are added to YARN_OPTS
+# YARN_CLIENT_OPTS when the respective command is run.
+# YARN_{COMMAND}_OPTS etc YARN_JT_OPTS applies to JobTracker
+# for e.g. YARN_CLIENT_OPTS applies to
+# more than one command (fs, dfs, fsck,
+# dfsadmin etc)
+#
+# YARN_CONF_DIR Alternate conf dir. Default is ${YARN_HOME}/conf.
+#
+# YARN_ROOT_LOGGER The root appender. Default is INFO,console
+#
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/yarn-config.sh
+
+cygwin=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+esac
+
+# if no args specified, show usage
+if [ $# = 0 ]; then
+ echo "Usage: hadoop [--config confdir] COMMAND"
+ echo "where COMMAND is one of:"
+ echo " resourcemanager run the ResourceManager"
+ echo " nodemanager run a nodemanager on each slave"
+ echo " historyserver run job history servers as a standalone daemon"
+ echo " job manipulate MapReduce jobs"
+ echo " queue get information regarding JobQueues"
+ echo " version print the version"
+ echo " jar <jar> run a jar file"
+ echo " classpath prints the class path needed to get the"
+ echo " Hadoop jar and the required libraries"
+ echo " daemonlog get/set the log level for each daemon"
+ 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 "${YARN_CONF_DIR}/yarn-env.sh" ]; then
+ . "${YARN_CONF_DIR}/yarn-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 [ "$YARN_HEAPSIZE" != "" ]; then
+ #echo "run with heapsize $YARN_HEAPSIZE"
+ JAVA_HEAP_MAX="-Xmx""$YARN_HEAPSIZE""m"
+ #echo $JAVA_HEAP_MAX
+fi
+
+# CLASSPATH initially contains $HADOOP_CONF_DIR & $YARN_CONF_DIR
+CLASSPATH="${HADOOP_CONF_DIR}:${YARN_CONF_DIR}"
+if [ "$YARN_USER_CLASSPATH_FIRST" != "" ] && [ "$YARN_CLASSPATH" != "" ] ; then
+ CLASSPATH=${CLASSPATH}:${YARN_CLASSPATH}
+fi
+CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar
+
+# for developers, add Hadoop classes to CLASSPATH
+if [ -d "$YARN_HOME/yarn-api/target/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$YARN_HOME/yarn-api/target/classes
+fi
+if [ -d "$YARN_HOME/yarn-common/target/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$YARN_HOME/yarn-common/target/classes
+fi
+if [ -d "$YARN_HOME/yarn-mapreduce/target/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$YARN_HOME/yarn-mapreduce/target/classes
+fi
+if [ -d "$YARN_HOME/yarn-master-worker/target/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$YARN_HOME/yarn-master-worker/target/classes
+fi
+if [ -d "$YARN_HOME/yarn-server/yarn-server-nodemanager/target/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$YARN_HOME/yarn-server/yarn-server-nodemanager/target/classes
+fi
+if [ -d "$YARN_HOME/yarn-server/yarn-server-common/target/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$YARN_HOME/yarn-server/yarn-server-common/target/classes
+fi
+if [ -d "$YARN_HOME/yarn-server/yarn-server-resourcemanager/target/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$YARN_HOME/yarn-server/yarn-server-resourcemanager/target/classes
+fi
+if [ -d "$YARN_HOME/build/test/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$YARN_HOME/target/test/classes
+fi
+if [ -d "$YARN_HOME/build/tools" ]; then
+ CLASSPATH=${CLASSPATH}:$YARN_HOME/build/tools
+fi
+
+
+# so that filenames w/ spaces are handled correctly in loops below
+IFS=
+
+# add hadoop-common libs to CLASSPATH
+
+if [ -d "$HADOOP_COMMON_HOME/build/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/build/classes
+fi
+if [ -d "$HADOOP_COMMON_HOME/build/webapps" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/build
+fi
+if [ -d "$HADOOP_COMMON_HOME/build/test/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/build/test/classes
+fi
+if [ -d "$HADOOP_COMMON_HOME/build/test/core/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/build/test/core/classes
+fi
+
+for f in $HADOOP_COMMON_HOME/hadoop-*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+for f in $HADOOP_COMMON_HOME/lib/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+if [ -d "$HADOOP_COMMON_HOME/build/ivy/lib/Hadoop-Common/common" ]; then
+for f in $HADOOP_COMMON_HOME/build/ivy/lib/Hadoop-Common/common/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+fi
+
+if [ -d "$HADOOP_COMMON_HOME/build/ivy/lib/Hadoop-Hdfs/common" ]; then
+for f in $HADOOP_COMMON_HOME/build/ivy/lib/Hadoop-Hdfs/common/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+fi
+
+if [ -d "$HADOOP_COMMON_HOME/build/ivy/lib/Hadoop/common" ]; then
+for f in $HADOOP_COMMON_HOME/build/ivy/lib/Hadoop/common/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+fi
+
+# add hadoop-hdfs libs to CLASSPATH
+
+for f in $HADOOP_HDFS_HOME/hadoop-*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+for f in $HADOOP_HDFS_HOME/lib/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+if [ -d "$HADOOP_HDFS_HOME/build/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_HDFS_HOME/build/classes
+fi
+if [ -d "$HADOOP_HDFS_HOME/build/webapps" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_HDFS_HOME/build
+fi
+if [ -d "$HADOOP_HDFS_HOME/build/test/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_HDFS_HOME/build/test/classes
+fi
+if [ -d "$HADOOP_HDFS_HOME/build/tools" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_HDFS_HOME/build/tools
+fi
+
+# add hadoop-mapred libs to CLASSPATH
+
+for f in $HADOOP_HDFS_HOME/hadoop-*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+for f in $HADOOP_HDFS_HOME/lib/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+if [ -d "$HADOOP_MAPRED_HOME/build/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME/build/classes
+fi
+if [ -d "$HADOOP_MAPRED_HOME/build/webapps" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME/build
+fi
+if [ -d "$HADOOP_MAPRED_HOME/build/test/classes" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME/build/test/classes
+fi
+if [ -d "$HADOOP_MAPRED_HOME/build/tools" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME/build/tools
+fi
+
+# for releases, add core mapred jar & webapps to CLASSPATH
+if [ -d "$HADOOP_MAPRED_HOME/webapps" ]; then
+ CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME
+fi
+
+# add libs to CLASSPATH
+for f in $HADOOP_MAPRED_HOME/lib/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+# add libs to CLASSPATH
+for f in $HADOOP_MAPRED_HOME/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+# add libs to CLASSPATH
+for f in $YARN_HOME/lib/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+# add yarn libs to CLASSPATH
+for f in $YARN_HOME/modules/*.jar; do
+ CLASSPATH=${CLASSPATH}:$f;
+done
+
+# add user-specified CLASSPATH last
+if [ "$YARN_USER_CLASSPATH_FIRST" = "" ] && [ "$YARN_CLASSPATH" != "" ]; then
+ CLASSPATH=${CLASSPATH}:${YARN_CLASSPATH}
+fi
+
+# default log directory & file
+if [ "$YARN_LOG_DIR" = "" ]; then
+ YARN_LOG_DIR="$YARN_HOME/logs"
+fi
+if [ "$YARN_LOGFILE" = "" ]; then
+ YARN_LOGFILE='yarn.log'
+fi
+
+# restore ordinary behaviour
+unset IFS
+
+# figure out which class to run
+if [ "$COMMAND" = "classpath" ] ; then
+ if $cygwin; then
+ CLASSPATH=`cygpath -p -w "$CLASSPATH"`
+ fi
+ echo $CLASSPATH
+ exit
+elif [ "$COMMAND" = "resourcemanager" ] ; then
+ CLASSPATH=${CLASSPATH}:$YARN_CONF_DIR/rm-config/log4j.properties
+ CLASS='org.apache.hadoop.yarn.server.resourcemanager.ResourceManager'
+ YARN_OPTS="$YARN_OPTS $YARN_RESOURCEMANAGER_OPTS"
+elif [ "$COMMAND" = "nodemanager" ] ; then
+ CLASSPATH=${CLASSPATH}:$YARN_CONF_DIR/nm-config/log4j.properties
+ CLASS='org.apache.hadoop.yarn.server.nodemanager.NodeManager'
+ if [[ $EUID -eq 0 ]]; then
+ YARN_OPTS="$YARN_OPTS -jvm server $YARN_NODEMANAGER_OPTS"
+ else
+ YARN_OPTS="$YARN_OPTS -server $YARN_NODEMANAGER_OPTS"
+ fi
+elif [ "$COMMAND" = "historyserver" ] ; then
+ CLASS=org.apache.hadoop.yarn.mapreduce.hs.JobHistoryServer
+ YARN_OPTS="$YARN_OPTS $YARN_JOB_HISTORYSERVER_OPTS"
+elif [ "$COMMAND" = "job" ] ; then
+ CLASS=org.apache.hadoop.mapred.JobClient
+ YARN_OPTS="$YARN_OPTS $YARN_CLIENT_OPTS"
+elif [ "$COMMAND" = "queue" ] ; then
+ CLASS=org.apache.hadoop.mapred.JobQueueClient
+ YARN_OPTS="$YARN_OPTS $YARN_CLIENT_OPTS"
+elif [ "$COMMAND" = "version" ] ; then
+ CLASS=org.apache.hadoop.util.VersionInfo
+ YARN_OPTS="$YARN_OPTS $YARN_CLIENT_OPTS"
+elif [ "$COMMAND" = "jar" ] ; then
+ CLASS=org.apache.hadoop.util.RunJar
+ YARN_OPTS="$YARN_OPTS $YARN_CLIENT_OPTS"
+elif [ "$COMMAND" = "daemonlog" ] ; then
+ CLASS=org.apache.hadoop.log.LogLevel
+ YARN_OPTS="$YARN_OPTS $YARN_CLIENT_OPTS"
+else
+ CLASS=$COMMAND
+fi
+
+# cygwin path translation
+if $cygwin; then
+ CLASSPATH=`cygpath -p -w "$CLASSPATH"`
+ YARN_HOME=`cygpath -w "$YARN_HOME"`
+ YARN_LOG_DIR=`cygpath -w "$YARN_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
+
+YARN_OPTS="$YARN_OPTS -Dyarn.log.dir=$YARN_LOG_DIR"
+YARN_OPTS="$YARN_OPTS -Dyarn.log.file=$YARN_LOGFILE"
+YARN_OPTS="$YARN_OPTS -Dyarn.home.dir=$YARN_HOME"
+YARN_OPTS="$YARN_OPTS -Dyarn.root.logger=${YARN_ROOT_LOGGER:-INFO,console}"
+if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
+ YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
+fi
+
+echo "$JAVA" -Dproc_$COMMAND $JAVA_HEAP_MAX $YARN_OPTS -classpath "$CLASSPATH" $CLASS "$@"
+exec "$JAVA" -Dproc_$COMMAND $JAVA_HEAP_MAX $YARN_OPTS -classpath "$CLASSPATH" $CLASS "$@"
+fi
Added: hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-config.sh
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-config.sh?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-config.sh (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-config.sh Thu Mar 17 20:21:13 2011
@@ -0,0 +1,68 @@
+# 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 hadoop 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 Hadoop installation
+export YARN_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
+ YARN_CONF_DIR=$confdir
+ fi
+fi
+
+# Allow alternate conf dir location.
+YARN_CONF_DIR="${YARN_CONF_DIR:-$YARN_HOME/conf}"
+
+#check to see it is specified whether to use the slaves or the
+# masters file
+if [ $# -gt 1 ]
+then
+ if [ "--hosts" = "$1" ]
+ then
+ shift
+ slavesfile=$1
+ shift
+ export YARN_SLAVES="${YARN_CONF_DIR}/$slavesfile"
+ fi
+fi
Added: hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-daemon.sh
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-daemon.sh?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-daemon.sh (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-daemon.sh Thu Mar 17 20:21:13 2011
@@ -0,0 +1,144 @@
+#!/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 yarn command as a daemon.
+#
+# Environment Variables
+#
+# YARN_CONF_DIR Alternate conf dir. Default is ${YARN_HOME}/conf.
+# YARN_LOG_DIR Where log files are stored. PWD by default.
+# YARN_MASTER host:path where hadoop code should be rsync'd from
+# YARN_PID_DIR The pid files are stored. /tmp by default.
+# YARN_IDENT_STRING A string representing this instance of hadoop. $USER by default
+# YARN_NICENESS The scheduling priority for daemons. Defaults to 0.
+##
+
+usage="Usage: yarn-daemon.sh [--config <conf-dir>] [--hosts hostlistfile] (start|stop) <yarn-command> "
+
+# if no args specified, show usage
+if [ $# -le 1 ]; then
+ echo $usage
+ exit 1
+fi
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+
+. "$bin"/yarn-config.sh
+
+# get arguments
+startStop=$1
+shift
+command=$1
+shift
+
+hadoop_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 "${YARN_CONF_DIR}/yarn-env.sh" ]; then
+ . "${YARN_CONF_DIR}/yarn-env.sh"
+fi
+
+if [ "$YARN_IDENT_STRING" = "" ]; then
+ export YARN_IDENT_STRING="$USER"
+fi
+
+# get log directory
+if [ "$YARN_LOG_DIR" = "" ]; then
+ export YARN_LOG_DIR="$YARN_HOME/logs"
+fi
+mkdir -p "$YARN_LOG_DIR"
+chown $YARN_IDENT_STRING $YARN_LOG_DIR
+
+if [ "$YARN_PID_DIR" = "" ]; then
+ YARN_PID_DIR=/tmp
+fi
+
+# some variables
+export YARN_LOGFILE=yarn-$YARN_IDENT_STRING-$command-$HOSTNAME.log
+export YARN_ROOT_LOGGER="INFO,DRFA"
+log=$YARN_LOG_DIR/yarn-$YARN_IDENT_STRING-$command-$HOSTNAME.out
+pid=$YARN_PID_DIR/yarn-$YARN_IDENT_STRING-$command.pid
+
+# Set default scheduling priority
+if [ "$YARN_NICENESS" = "" ]; then
+ export YARN_NICENESS=0
+fi
+
+case $startStop in
+
+ (start)
+
+ mkdir -p "$YARN_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 [ "$YARN_MASTER" != "" ]; then
+ echo rsync from $YARN_MASTER
+ rsync -a -e ssh --delete --exclude=.svn --exclude='logs/*' --exclude='contrib/hod/logs/*' $YARN_MASTER/ "$YARN_HOME"
+ fi
+
+ hadoop_rotate_log $log
+ echo starting $command, logging to $log
+ cd "$YARN_HOME"
+ nohup nice -n $YARN_NICENESS "$YARN_HOME"/bin/yarn --config $YARN_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: hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-daemons.sh
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-daemons.sh?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-daemons.sh (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/bin/yarn-daemons.sh Thu Mar 17 20:21:13 2011
@@ -0,0 +1,36 @@
+#!/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 Yarn command on all slave hosts.
+
+usage="Usage: yarn-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 "${BASH_SOURCE-$0}"`
+bin=`cd "$bin"; pwd`
+
+. $bin/yarn-config.sh
+
+exec "$bin/slaves.sh" --config $YARN_CONF_DIR cd "$YARN_HOME" \; "$bin/yarn-daemon.sh" --config $YARN_CONF_DIR "$@"
+
Added: hadoop/mapreduce/branches/MR-279/yarn/conf/slaves
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/conf/slaves?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/conf/slaves (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/conf/slaves Thu Mar 17 20:21:13 2011
@@ -0,0 +1 @@
+localhost
Added: hadoop/mapreduce/branches/MR-279/yarn/conf/yarn-env.sh
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/conf/yarn-env.sh?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/conf/yarn-env.sh (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/conf/yarn-env.sh Thu Mar 17 20:21:13 2011
@@ -0,0 +1,76 @@
+# 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.
+
+# resolve links - $0 may be a softlink
+export YARN_CONF_DIR="${YARN_CONF_DIR:-$YARN_HOME/conf}"
+
+# some Java parameters
+# export JAVA_HOME=/home/y/libexec/jdk1.6.0/
+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 [ "$YARN_HEAPSIZE" != "" ]; then
+ #echo "run with heapsize $YARN_HEAPSIZE"
+ JAVA_HEAP_MAX="-Xmx""$YARN_HEAPSIZE""m"
+ #echo $JAVA_HEAP_MAX
+fi
+
+# CLASSPATH initially contains $YARN_CONF_DIR
+CLASSPATH="${YARN_CONF_DIR}"
+CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar
+
+# so that filenames w/ spaces are handled correctly in loops below
+IFS=
+
+
+# default log directory & file
+if [ "$YARN_LOG_DIR" = "" ]; then
+ YARN_LOG_DIR="$YARN_HOME/logs"
+fi
+if [ "$YARN_LOGFILE" = "" ]; then
+ YARN_LOGFILE='yarn.log'
+fi
+
+# default policy file for service-level authorization
+if [ "$YARN_POLICYFILE" = "" ]; then
+ YARN_POLICYFILE="hadoop-policy.xml"
+fi
+
+# restore ordinary behaviour
+unset IFS
+
+
+YARN_OPTS="$YARN_OPTS -Dyarn.log.dir=$YARN_LOG_DIR"
+YARN_OPTS="$YARN_OPTS -Dyarn.log.file=$YARN_LOGFILE"
+YARN_OPTS="$YARN_OPTS -Dyarn.home.dir=$YARN_COMMON_HOME"
+YARN_OPTS="$YARN_OPTS -Dyarn.id.str=$YARN_IDENT_STRING"
+YARN_OPTS="$YARN_OPTS -Dyarn.root.logger=${YARN_ROOT_LOGGER:-INFO,console}"
+if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
+ YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
+fi
+YARN_OPTS="$YARN_OPTS -Dyarn.policy.file=$YARN_POLICYFILE"
+
+
Added: hadoop/mapreduce/branches/MR-279/yarn/conf/yarn-site.xml
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/conf/yarn-site.xml?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/conf/yarn-site.xml (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/conf/yarn-site.xml Thu Mar 17 20:21:13 2011
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<configuration>
+
+<!-- Site specific YARN configuration properties -->
+
+</configuration>
Added: hadoop/mapreduce/branches/MR-279/yarn/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/pom.xml?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/pom.xml (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/pom.xml Thu Mar 17 20:21:13 2011
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>yarn</artifactId>
+ <version>${yarn.version}</version>
+ <packaging>pom</packaging>
+
+ <name>yarn</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <test.logs>true</test.logs>
+ <test.timeout>600000</test.timeout>
+ <hadoop-common.version>0.22.0-SNAPSHOT</hadoop-common.version>
+ <hadoop-hdfs.version>0.22.0-SNAPSHOT</hadoop-hdfs.version>
+ <yarn.version>1.0-SNAPSHOT</yarn.version>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <!-- The Avro dependency must be defined before hadoop-common to override
+ the transitive dependency on avro in hadoop-common. -->
+ <dependency>
+ <groupId>org.apache.avro</groupId>
+ <artifactId>avro</artifactId>
+ <version>1.4.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <artifactId>paranamer-ant</artifactId>
+ <groupId>com.thoughtworks.paranamer</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <version>${hadoop-common.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-el</groupId>
+ <artifactId>commons-el</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>tomcat</groupId>
+ <artifactId>jasper-runtime</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>tomcat</groupId>
+ <artifactId>jasper-compiler</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-2.1-jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common-test</artifactId>
+ <version>${hadoop-common.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <version>${hadoop-hdfs.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-servlet</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ <version>3.2.3.Final</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>2.3.1</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <!-- pre 2.1 ignores project.build.sourceEncoding -->
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <descriptors>
+ <descriptor>assembly/all.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.4.1</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- requires 2.5+ to make system properties work -->
+ <!-- requires 2.7+ to avoid SUREFIRE-640 -->
+ <version>2.7.2</version>
+ <configuration>
+ <failIfNoTests>false</failIfNoTests>
+ <redirectTestOutputToFile>${test.logs}</redirectTestOutputToFile>
+ <forkedProcessTimeoutInSeconds>${test.timeout}</forkedProcessTimeoutInSeconds>
+ <environmentVariables>
+ <JAVA_HOME>${java.home}</JAVA_HOME>
+ </environmentVariables>
+ <systemPropertyVariables>
+ <build.dir>${project.build.directory}</build.dir>
+ <build.output.dir>${project.build.outputDirectory}</build.output.dir>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>2.3.1</version>
+ </plugin>
+ <plugin>
+ <groupId>com.atlassian.maven.plugins</groupId>
+ <artifactId>maven-clover2-plugin</artifactId>
+ <version>3.0.2</version>
+ <configuration>
+ <licenseLocation>/home/y/conf/clover/clover.license</licenseLocation>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>instrument</goal>
+ <goal>aggregate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <modules>
+ <module>yarn-api</module>
+ <module>yarn-common</module>
+ <module>yarn-server</module>
+ </modules>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <findbugsXmlOutput>true</findbugsXmlOutput>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.atlassian.maven.plugins</groupId>
+ <artifactId>maven-clover2-plugin</artifactId>
+ <version>3.0.2</version>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/pom.xml?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/pom.xml (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/pom.xml Thu Mar 17 20:21:13 2011
@@ -0,0 +1,30 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>yarn</artifactId>
+ <groupId>org.apache.hadoop</groupId>
+ <version>${yarn.version}</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>yarn-api</artifactId>
+ <name>yarn-api</name>
+ <version>${yarn.version}</version>
+ <url>http://maven.apache.org</url>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.avro</groupId>
+ <artifactId>avro-maven-plugin</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/AMRMProtocol.genavro
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/AMRMProtocol.genavro?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/AMRMProtocol.genavro (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/AMRMProtocol.genavro Thu Mar 17 20:21:13 2011
@@ -0,0 +1,27 @@
+@namespace("org.apache.hadoop.yarn")
+protocol AMRMProtocol {
+
+ import idl "yarn/yarn-api/src/main/avro/yarn-types.genavro";
+
+ // Scheduler
+ record Priority {
+ int priority;
+ }
+
+ record ResourceRequest {
+ Priority priority;
+ string hostName;
+ Resource capability;
+ int numContainers;
+ }
+ record AMResponse {
+ boolean reboot;
+ int responseId;
+ array<Container> containers;
+ }
+
+ void registerApplicationMaster(ApplicationMaster applicationMaster) throws YarnRemoteException;
+ void finishApplicationMaster(ApplicationMaster applicationMaster) throws YarnRemoteException;
+ AMResponse allocate(ApplicationStatus status, array<ResourceRequest> ask, array<Container> release) throws YarnRemoteException;
+
+ }
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/ClientRMProtocol.genavro
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/ClientRMProtocol.genavro?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/ClientRMProtocol.genavro (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/ClientRMProtocol.genavro Thu Mar 17 20:21:13 2011
@@ -0,0 +1,45 @@
+@namespace("org.apache.hadoop.yarn")
+protocol ClientRMProtocol {
+
+ import idl "yarn/yarn-api/src/main/avro/yarn-types.genavro";
+
+ record Priority {
+ int priority;
+ }
+
+ record ApplicationSubmissionContext {
+ ApplicationID applicationId;
+ union {null, string} applicationName;
+ Resource masterCapability; // TODO: Needs RM validation
+
+ //all the files required by the container to run the ApplicationMaster
+ //KEY-> destination dir name
+ //VALUE-> source path
+ map<URL> resources;
+ union {null, map<LocalResource>} resources_todo;
+
+ // TODO - Remove fsTokens (url encoded)
+ union {null, array<string>} fsTokens;
+ union {null, bytes} fsTokens_todo;
+
+ //env to be set before launching the command for ApplicationMaster
+ //KEY-> env variable name
+ //VALUE -> env variable value.
+ map<string> environment;
+ //command-line of the container that is going to launch the ApplicationMaster.
+ array<string> command;
+ union {null, string} queue;
+ union {null, Priority} priority;
+ string user; // TODO: Shouldn't pass it like this.
+ }
+
+ record YarnClusterMetrics {
+ int numNodeManagers;
+ }
+
+ ApplicationID getNewApplicationId() throws YarnRemoteException;
+ ApplicationMaster getApplicationMaster(ApplicationID applicationId) throws YarnRemoteException;
+ void submitApplication(ApplicationSubmissionContext context) throws YarnRemoteException;
+ void finishApplication(ApplicationID applicationId) throws YarnRemoteException;
+ YarnClusterMetrics getClusterMetrics() throws YarnRemoteException;
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/ContainerManager.genavro
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/ContainerManager.genavro?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/ContainerManager.genavro (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/ContainerManager.genavro Thu Mar 17 20:21:13 2011
@@ -0,0 +1,50 @@
+@namespace("org.apache.hadoop.yarn")
+protocol ContainerManager {
+
+ import idl "yarn/yarn-api/src/main/avro/yarn-types.genavro";
+
+ enum YarnContainerTags {
+ // Any env reference of the form <YARN_ENV_TAG.PROPERTYNAME> either
+ // in the environment specification or in the command line
+ // for e.g. <YARN_ENV_TAG.PWD> will be expanded by the ContainerManager
+ // to refer to the corresponding env variable value.
+ YARN_ENV_TAG,
+ // Any reference of the form <YARN_WORK_DIR> either in the environment
+ // specification or in the command line will be expanded by
+ // the ContainerManager to refer to the current working directory
+ // of the Container
+ YARN_WORK_DIR
+ }
+
+ record ContainerLaunchContext {
+ ContainerID id;
+ string user; // TODO: Shouldn't pass it like this.
+ Resource resource; // TODO: Needs RM validation
+ union {null, map<LocalResource>} resources;
+
+ union {null, bytes} containerTokens; // FileSystem related and other application specific tokens.
+ union {null, map<bytes>} serviceData;
+
+ //env to be set before launching the command
+ //KEY-> env variable name
+ //VALUE -> env variable value.
+ map<string> env;
+
+ //commandline to launch the container. All resources are downloaded in the
+ //working directory of the command.
+ array<string> command;
+ }
+
+ record ContainerStatus {
+ ContainerID containerID;
+ ContainerState state;
+ int exitStatus;
+ }
+
+ void startContainer(ContainerLaunchContext container) throws YarnRemoteException;
+ void stopContainer(ContainerID containerID) throws YarnRemoteException;
+ void cleanupContainer(ContainerID containerID) throws YarnRemoteException;
+
+ ContainerStatus getContainerStatus(ContainerID containerID) throws YarnRemoteException;
+
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/yarn-types.genavro
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/yarn-types.genavro?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/yarn-types.genavro (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/avro/yarn-types.genavro Thu Mar 17 20:21:13 2011
@@ -0,0 +1,108 @@
+@namespace("org.apache.hadoop.yarn")
+protocol types {
+
+ record ApplicationID {
+ int id;
+ long clusterTimeStamp;
+ }
+
+ record ContainerID {
+ ApplicationID appID; // the application id to which this container belong.
+ int id;// unique string for this application
+ }
+
+ error YarnRemoteException {
+ union { null, string } message;
+ union { null, string } trace; //stackTrace
+ union { null, YarnRemoteException } cause;
+ }
+
+ record Resource {
+ int memory;
+ //int diskspace;
+ }
+
+ // State of the container on the ContainerManager.
+ enum ContainerState {
+ INTIALIZING,
+ RUNNING,
+ COMPLETE
+ }
+
+ record ContainerToken {
+ bytes identifier;
+ bytes password;
+ string kind;
+ string service;
+ }
+
+ record Container {
+ ContainerID id;
+ string hostName;
+ Resource resource;
+ ContainerState state;
+ union {ContainerToken, null} containerToken;
+ }
+
+ enum ApplicationState {
+ PENDING,
+ ALLOCATING,
+ ALLOCATED,
+ LAUNCHING,
+ LAUNCHED,
+ RUNNING,
+ PAUSED,
+ CLEANUP,
+ COMPLETED,
+ KILLED,
+ FAILED
+ }
+
+ record ApplicationStatus {
+ int responseID; // TODO: This should be renamed as previousResponseID
+ ApplicationID applicationId;
+ float progress;
+ long lastSeen;
+ }
+
+ record ApplicationMaster {
+ ApplicationID applicationId;
+ union { null, string } host;
+ int rpcPort;
+ int httpPort;
+ ApplicationStatus status;
+ ApplicationState state;
+ union { null, string } clientToken;
+ }
+
+ record URL {
+ string scheme;
+ union { null, string } host;
+ int port;
+ string file;
+ }
+
+ enum LocalResourceVisibility {
+ // accessible to applications from all users
+ PUBLIC,
+ // accessible only to applications from the submitting user
+ PRIVATE,
+ // accessible only to this application
+ APPLICATION
+ }
+
+ enum LocalResourceType {
+ // an archive to be expanded
+ ARCHIVE,
+ // uninterpreted file
+ FILE
+ }
+
+ record LocalResource {
+ URL resource;
+ long size;
+ long timestamp;
+ LocalResourceType type;
+ LocalResourceVisibility state;
+ }
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/Application.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/Application.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/Application.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/Application.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,38 @@
+/**
+* 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.hadoop.yarn;
+
+import org.apache.hadoop.yarn.ApplicationID;
+import org.apache.hadoop.yarn.ApplicationState;
+import org.apache.hadoop.yarn.ApplicationStatus;
+
+/**
+ * A read-only application interface
+ */
+public interface Application {
+ ApplicationID id();
+ CharSequence user();
+ CharSequence queue();
+ CharSequence name();
+ ApplicationStatus status();
+ ApplicationState state();
+ CharSequence master();
+ int httpPort();
+ boolean isFinished();
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/pom.xml
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/pom.xml?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/pom.xml (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/pom.xml Thu Mar 17 20:21:13 2011
@@ -0,0 +1,39 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>yarn</artifactId>
+ <groupId>org.apache.hadoop</groupId>
+ <version>${yarn.version}</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>yarn-common</artifactId>
+ <name>yarn-common</name>
+ <version>${yarn.version}</version>
+ <url>http://maven.apache.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>yarn-api</artifactId>
+ <version>${yarn.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.3.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ <phase>test-compile</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/YarnException.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/YarnException.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/YarnException.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/YarnException.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,29 @@
+/**
+* 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.hadoop.yarn;
+
+/** Base Yarn Exception.
+ */
+public class YarnException extends RuntimeException {
+ public YarnException(Throwable cause) { super(cause); }
+ public YarnException(String message) { super(message); }
+ public YarnException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YARNApplicationConstants.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YARNApplicationConstants.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YARNApplicationConstants.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YARNApplicationConstants.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,49 @@
+/**
+* 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.hadoop.yarn.conf;
+
+public class YARNApplicationConstants {
+
+ public static final String HADOOP_MAPREDUCE_CLIENT_APP_JAR_NAME =
+ "hadoop-mapreduce-client-app-1.0-SNAPSHOT.jar";
+
+ // This should be the directory where splits file gets localized on the node
+ // running ApplicationMaster.
+ public static final String JOB_SUBMIT_DIR = "jobSubmitDir";
+
+ // This should be the name of the localized job-configuration file on the node
+ // running ApplicationMaster and Task
+ public static final String JOB_CONF_FILE = "job.xml";
+ // This should be the name of the localized job-jar file on the node running
+ // individual containers/tasks.
+ public static final String JOB_JAR = "job.jar";
+
+ public static final String NM_HOSTS_CONF_KEY = "NM_HOSTS";
+
+ public static final String APPS_STAGING_DIR_KEY = "yarn.apps.stagingDir";
+
+ public static final String YARN_MAPREDUCE_APP_JAR_PATH =
+ "$YARN_HOME/modules/" + HADOOP_MAPREDUCE_CLIENT_APP_JAR_NAME;
+
+ public static final String LOCAL_DIR_ENV = "YARN_LOCAL_DIRS";
+
+ // TODO: Move into MR.
+ public static final String MR_APPMASTER_COMMAND_OPTS =
+ "yarn.appMaster.commandOpts";
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,103 @@
+/**
+* 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.hadoop.yarn.conf;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.Text;
+
+public class YarnConfiguration extends Configuration {
+
+ public static final String RM_PREFIX = "yarn.server.resourcemanager.";
+
+ public static final String SCHEDULER_ADDRESS = RM_PREFIX
+ + "scheduler.address";
+
+ public static final String AM_EXPIRY_INTERVAL = RM_PREFIX
+ + "application.expiry.interval";
+
+ public static final long DEFAULT_AM_EXPIRY_INTERVAL = 60000L;
+
+ public static final String NM_EXPIRY_INTERVAL = RM_PREFIX
+ + "nodemanager.expiry.interval";
+
+ public static final long DEFAULT_NM_EXPIRY_INTERVAL = 600000L;
+
+ public static final String DEFAULT_SCHEDULER_BIND_ADDRESS = "0.0.0.0:8030";
+
+ public static final String APPSMANAGER_ADDRESS = RM_PREFIX
+ + "appsManager.address";
+
+ public static final String DEFAULT_APPSMANAGER_BIND_ADDRESS =
+ "0.0.0.0:8040";
+
+ private static final String YARN_DEFAULT_XML_FILE = "yarn-default.xml";
+ private static final String YARN_SITE_XML_FILE = "yarn-site.xml";
+
+ public static final String MASTER_KEYS_DIR = "/master_keys_dir";
+
+ public static final String APPLICATION_MANAGER_PRINCIPAL =
+ "yarn.jobmanager.user-name";
+
+ public static final String RM_WEBAPP_BIND_ADDRESS = RM_PREFIX
+ + "webapp.address";
+
+ public static final String DEFAULT_RM_WEBAPP_BIND_ADDRESS = "0.0.0.0:8088";
+
+ static {
+ Configuration.addDefaultResource(YARN_DEFAULT_XML_FILE);
+ Configuration.addDefaultResource(YARN_SITE_XML_FILE);
+ }
+
+ // The FS delegation tokens' storage on the remote FS. To be written by the
+ // job-submitter and to be readable by the job-localizer.
+ // TODO: remove
+ public static final String FS_TOKENS_FILE_NAME = "fs-token-storage";
+
+ public static final String MASTER_KEY_FILE_NAME =
+ "master_key_file";
+
+ // TODO: This should go away once RM and NM share master key directly
+ public static final Text RMNMMasterKeyAliasName = new Text("masterKeyAliasName");
+
+ // The token file for the application. Should contain tokens for access to
+ // remote file system and may optionally contain application specific tokens.
+ // For now, generated by the AppManagers and used by NodeManagers and the
+ // Containers.
+ public static final String APPLICATION_TOKENS_FILE =
+ "appTokens";
+
+ public static final String RM_SERVER_PRINCIPAL_KEY =
+ "yarn.resourcemanager.principal";
+
+ public static final String APPLICATION_MASTER_TOKEN_ENV_NAME =
+ "AppMasterTokenEnv";
+
+ public static final String APPLICATION_CLIENT_SECRET_ENV_NAME =
+ "AppClientTokenEnv";
+
+ public static final String RESOURCE_SCHEDULER = RM_PREFIX + "scheduler";
+
+ public YarnConfiguration() {
+ super();
+ }
+
+ public YarnConfiguration(Configuration conf) {
+ super(conf);
+ }
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/AbstractEvent.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/AbstractEvent.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/AbstractEvent.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/AbstractEvent.java Thu Mar 17 20:21:13 2011
@@ -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.hadoop.yarn.event;
+
+/**
+ * parent class of all the events. All events extend this class.
+ */
+public abstract class AbstractEvent<TYPE extends Enum<TYPE>>
+ implements Event<TYPE> {
+
+ private final TYPE type;
+ private final long timestamp;
+
+ // use this if you DON'T care about the timestamp
+ public AbstractEvent(TYPE type) {
+ this.type = type;
+ // We're not generating a real timestamp here. It's too expensive.
+ timestamp = -1L;
+ }
+
+ // use this if you care about the timestamp
+ public AbstractEvent(TYPE type, long timestamp) {
+ this.type = type;
+ this.timestamp = timestamp;
+ }
+
+ @Override
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ @Override
+ public TYPE getType() {
+ return type;
+ }
+
+ @Override
+ public String toString() {
+ return "EventType: " + getType();
+ }
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/AsyncDispatcher.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/AsyncDispatcher.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/AsyncDispatcher.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/AsyncDispatcher.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,123 @@
+/**
+* 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.hadoop.yarn.event;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.yarn.service.AbstractService;
+
+/**
+ * Dispatches events in a separate thread. Currently only single thread does
+ * that. Potentially there could be multiple channels for each event type
+ * class and a thread pool can be used to dispatch the events.
+ *
+ */
+public class AsyncDispatcher extends AbstractService implements Dispatcher {
+
+ private static final Log LOG = LogFactory.getLog(AsyncDispatcher.class);
+
+ private BlockingQueue<Event> eventQueue = new LinkedBlockingQueue<Event>();
+ private volatile boolean stopped = false;
+
+ private Thread eventHandlingThread;
+ private Map<Class<? extends Enum>, EventHandler> eventDispatchers =
+ new HashMap<Class<? extends Enum>, EventHandler>();
+
+ public AsyncDispatcher() {
+ super("Dispatcher");
+ }
+
+ @Override
+ public void start() {
+ //start all the components
+ super.start();
+
+ eventHandlingThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ while (!stopped && !Thread.currentThread().isInterrupted()) {
+ Event event;
+ try {
+ event = eventQueue.take();
+ } catch(InterruptedException ie) {
+ LOG.info("AsyncDispatcher thread interrupted", ie);
+ return;
+ }
+ if (event != null) {
+ dispatch(event);
+ }
+ }
+ }
+ });
+ eventHandlingThread.start();
+ }
+
+ @Override
+ public void stop() {
+ stopped = true;
+ eventHandlingThread.interrupt();
+ try {
+ eventHandlingThread.join();
+ } catch (InterruptedException ie) {
+ LOG.debug("Interruped Exception while stopping", ie);
+ }
+
+ //stop all the components
+ super.stop();
+ }
+
+ protected void dispatch(Event event) {
+ //all events go thru this loop
+ LOG.info("Dispatching the event " + event.toString());
+
+ Class<? extends Enum> type = event.getType().getDeclaringClass();
+
+ try{
+ eventDispatchers.get(type).handle(event);
+ }
+ catch (Throwable t) {
+ LOG.fatal("Error in dispatcher thread. Exiting..", t);
+ System.exit(-1);
+ }
+ }
+
+ @Override
+ public void register(Class<? extends Enum> eventType, EventHandler handler) {
+ eventDispatchers.put(eventType, handler);
+ }
+
+ @Override
+ public EventHandler getEventHandler() {
+ // TODO Auto-generated method stub
+ return new EventHandler() {
+ @Override
+ public void handle(Event event) {
+ /* all this method does is enqueue all the events onto the queue */
+ eventQueue.offer(event);
+ }
+
+ };
+ }
+
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/Dispatcher.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/Dispatcher.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/Dispatcher.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/Dispatcher.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,32 @@
+/**
+* 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.hadoop.yarn.event;
+
+/**
+ * Event Dispatcher interface. It dispatches events to registered
+ * event handlers based on event types.
+ *
+ */
+public interface Dispatcher {
+
+ EventHandler getEventHandler();
+
+ void register(Class<? extends Enum> eventType, EventHandler handler);
+
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/Event.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/Event.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/Event.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/Event.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,30 @@
+/**
+* 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.hadoop.yarn.event;
+
+/**
+ * Interface defining events api.
+ *
+ */
+public interface Event<TYPE extends Enum<TYPE>> {
+
+ TYPE getType();
+ long getTimestamp();
+ String toString();
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/EventHandler.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/EventHandler.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/EventHandler.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/event/EventHandler.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,30 @@
+/**
+* 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.hadoop.yarn.event;
+
+/**
+ * Interface for handling events of type T
+ *
+ * @param <T> paremeterized event of type T
+ */
+public interface EventHandler<T extends Event> {
+
+ void handle(T event);
+
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/AvroYarnRPC.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/AvroYarnRPC.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/AvroYarnRPC.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/AvroYarnRPC.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,62 @@
+/**
+* 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.hadoop.yarn.ipc;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
+import org.apache.avro.ipc.Server;
+import org.apache.avro.ipc.SocketServer;
+import org.apache.avro.ipc.SocketTransceiver;
+import org.apache.avro.specific.SpecificRequestor;
+import org.apache.avro.specific.SpecificResponder;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.token.SecretManager;
+import org.apache.hadoop.security.token.TokenIdentifier;
+import org.apache.hadoop.yarn.YarnException;
+
+/*
+ * This uses Avro's simple Socket based RPC. Can be replaced with Netty based
+ * when Yarn is upgraded to Avro 1.4.
+ */
+public class AvroYarnRPC extends YarnRPC {
+
+ @Override
+ public Object getProxy(Class protocol,
+ InetSocketAddress addr, Configuration conf) {
+ try {
+ return SpecificRequestor.getClient(protocol, new SocketTransceiver(addr));
+ } catch (IOException e) {
+ throw new YarnException(e);
+ }
+ }
+
+ @Override
+ public Server getServer(Class protocol, Object instance,
+ InetSocketAddress addr, Configuration conf,
+ SecretManager<? extends TokenIdentifier> secretManager) {
+ try {
+ return new SocketServer(new SpecificResponder(protocol, instance),
+ addr);
+ } catch (IOException e) {
+ throw new YarnException(e);
+ }
+ }
+
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/HadoopYarnRPC.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/HadoopYarnRPC.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/HadoopYarnRPC.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/HadoopYarnRPC.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,101 @@
+/**
+* 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.hadoop.yarn.ipc;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
+import org.apache.avro.ipc.Server;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
+import org.apache.hadoop.ipc.AvroSpecificRpcEngine;
+import org.apache.hadoop.ipc.RPC;
+import org.apache.hadoop.security.token.SecretManager;
+import org.apache.hadoop.security.token.TokenIdentifier;
+import org.apache.hadoop.yarn.YarnException;
+
+/**
+ * This uses Hadoop RPC. Uses a tunnel AvroSpecificRpcEngine over
+ * Hadoop connection.
+ * This does not give cross-language wire compatibility, since the Hadoop
+ * RPC wire format is non-standard, but it does permit use of Avro's protocol
+ * versioning features for inter-Java RPCs.
+ */
+public class HadoopYarnRPC extends YarnRPC {
+
+ private static final Log LOG = LogFactory.getLog(HadoopYarnRPC.class);
+
+ @Override
+ public Object getProxy(Class protocol, InetSocketAddress addr,
+ Configuration conf) {
+ Configuration myConf = new Configuration(conf);
+ LOG.info("Creating a HadoopYarnRpc proxy for protocol " + protocol);
+ LOG.debug("Configured SecurityInfo class name is "
+ + myConf.get(CommonConfigurationKeys.HADOOP_SECURITY_INFO_CLASS_NAME));
+ RPC.setProtocolEngine(myConf, protocol, AvroSpecificRpcEngine.class);
+ try {
+ return RPC.getProxy(protocol, 1, addr, myConf);
+ } catch (IOException e) {
+ throw new YarnException(e);
+ }
+ }
+
+ @Override
+ public Server getServer(Class protocol, Object instance,
+ InetSocketAddress addr, Configuration conf,
+ SecretManager<? extends TokenIdentifier> secretManager) {
+ LOG.info("Creating a HadoopYarnRpc server for protocol " + protocol);
+ LOG.info("Configured SecurityInfo class name is "
+ + conf.get(CommonConfigurationKeys.HADOOP_SECURITY_INFO_CLASS_NAME));
+ RPC.setProtocolEngine(conf, protocol, AvroSpecificRpcEngine.class);
+ final RPC.Server hadoopServer;
+ try {
+ hadoopServer = RPC.getServer(protocol, instance, addr.getHostName(),
+ addr.getPort(), 1, false, conf, secretManager);
+ } catch (IOException e) {
+ throw new YarnException(e);
+ }
+ Server server = new Server() {
+ @Override
+ public void close() {
+ hadoopServer.stop();
+ }
+
+ @Override
+ public int getPort() {
+ return hadoopServer.getListenerAddress().getPort();
+ }
+
+ @Override
+ public void join() throws InterruptedException {
+ hadoopServer.join();
+ }
+
+ @Override
+ public void start() {
+ hadoopServer.start();
+ }
+ };
+ return server;
+
+ }
+
+}
\ No newline at end of file
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/RPCUtil.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,67 @@
+/**
+* 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.hadoop.yarn.ipc;
+
+import org.apache.hadoop.yarn.YarnRemoteException;
+
+public class RPCUtil {
+
+ /**
+ * Returns the YarnRemoteException which is serializable by
+ * Avro.
+ */
+ public static YarnRemoteException getRemoteException(Throwable t) {
+ YarnRemoteException e = new YarnRemoteException();
+ if (t != null) {
+ e.message = t.getMessage();
+ StringBuilder buf = new StringBuilder();
+ StackTraceElement[] trace = t.getStackTrace();
+ if (trace != null) {
+ for (StackTraceElement element : trace) {
+ buf.append(element.toString() + "\n at ");
+ }
+ e.trace = buf.toString();
+ }
+ Throwable cause = t.getCause();
+ if (cause != null) {
+ e.cause = getRemoteException(cause);
+ }
+ }
+ return e;
+ }
+
+ /**
+ * Returns the YarnRemoteException which is serializable by
+ * Avro.
+ */
+ public static YarnRemoteException getRemoteException(String message) {
+ YarnRemoteException e = new YarnRemoteException();
+ if (message != null) {
+ e.message = message;
+ }
+ return e;
+ }
+
+ public static String toString(YarnRemoteException e) {
+ return (e.message == null ? "" : e.message) +
+ (e.trace == null ? "" : "\n StackTrace: " + e.trace) +
+ (e.cause == null ? "" : "\n Caused by: " + toString(e.cause));
+
+ }
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/YarnRPC.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/YarnRPC.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/YarnRPC.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/YarnRPC.java Thu Mar 17 20:21:13 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.hadoop.yarn.ipc;
+
+import java.net.InetSocketAddress;
+
+import org.apache.avro.ipc.Server;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.token.SecretManager;
+import org.apache.hadoop.security.token.TokenIdentifier;
+import org.apache.hadoop.yarn.YarnException;
+
+/**
+ * Abstraction to get the RPC implementation for Yarn.
+ */
+public abstract class YarnRPC {
+
+ public static final String RPC_CLASSNAME
+ = "org.apache.hadoop.yarn.ipc.YarnRPC.classname";
+
+ //use the default as Hadoop RPC
+ public static final String DEFAULT_RPC
+ = "org.apache.hadoop.yarn.ipc.HadoopYarnRPC";
+
+ public abstract Object getProxy(Class protocol, InetSocketAddress addr,
+ Configuration conf);
+
+ public abstract Server getServer(Class protocol, Object instance,
+ InetSocketAddress addr, Configuration conf,
+ SecretManager<? extends TokenIdentifier> secretManager);
+
+ public static YarnRPC create(Configuration conf) {
+ String clazzName = conf.get(RPC_CLASSNAME);
+ if (clazzName == null) {
+ clazzName = DEFAULT_RPC;
+ }
+ try {
+ return (YarnRPC) Class.forName(clazzName).newInstance();
+ } catch (Exception e) {
+ throw new YarnException(e);
+ }
+ }
+
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenIdentifier.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenIdentifier.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenIdentifier.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenIdentifier.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,77 @@
+/**
+* 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.hadoop.yarn.security;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.token.TokenIdentifier;
+import org.apache.hadoop.yarn.ApplicationID;
+
+// TODO: Make it avro-ish. TokenIdentifier really isn't serialized
+// as writable but simply uses readFields method in SaslRpcServer
+// for deserializatoin.
+public class ApplicationTokenIdentifier extends TokenIdentifier {
+
+ public static final Text KIND_NAME = new Text("YARN_APPLICATION_TOKEN");
+
+ private Text appId;
+
+ // TODO: Add more information in the tokenID such that it is not
+ // transferrable, more secure etc.
+
+ public ApplicationTokenIdentifier(ApplicationID id) {
+ this.appId = new Text(Integer.toString(id.id));
+ }
+
+ public ApplicationTokenIdentifier() {
+ this.appId = new Text();
+ }
+
+ public Text getApplicationID() {
+ return appId;
+ }
+
+ @Override
+ public void write(DataOutput out) throws IOException {
+ appId.write(out);
+ }
+
+ @Override
+ public void readFields(DataInput in) throws IOException {
+ appId.readFields(in);
+ }
+
+ @Override
+ public Text getKind() {
+ return KIND_NAME;
+ }
+
+ @Override
+ public UserGroupInformation getUser() {
+ if (appId == null || "".equals(appId.toString())) {
+ return null;
+ }
+ return UserGroupInformation.createRemoteUser(appId.toString());
+ }
+
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenSecretManager.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenSecretManager.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenSecretManager.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenSecretManager.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,78 @@
+/**
+* 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.hadoop.yarn.security;
+
+import javax.crypto.SecretKey;
+
+import org.apache.hadoop.security.token.SecretManager;
+
+public class ApplicationTokenSecretManager extends
+ SecretManager<ApplicationTokenIdentifier> {
+
+ // TODO: mark as final
+ private SecretKey masterKey; // For now only one masterKey, for ever.
+
+ // TODO: add expiry for masterKey
+ // TODO: add logic to handle with multiple masterKeys, only one being used for
+ // creating new tokens at any time.
+ // TODO: Make he masterKey more secure, non-transferrable etc.
+
+ /**
+ * Default constructor
+ */
+ public ApplicationTokenSecretManager() {
+ this.masterKey = generateSecret();
+ }
+
+ // TODO: this should go away.
+ public void setMasterKey(SecretKey mk) {
+ this.masterKey = mk;
+ }
+
+ // TODO: this should go away.
+ public SecretKey getMasterKey() {
+ return masterKey;
+ }
+
+ /**
+ * Convert the byte[] to a secret key
+ * @param key the byte[] to create the secret key from
+ * @return the secret key
+ */
+ public static SecretKey createSecretKey(byte[] key) {
+ return SecretManager.createSecretKey(key);
+ }
+
+ @Override
+ public byte[] createPassword(ApplicationTokenIdentifier identifier) {
+ return createPassword(identifier.getBytes(), masterKey);
+ }
+
+ @Override
+ public byte[] retrievePassword(ApplicationTokenIdentifier identifier)
+ throws SecretManager.InvalidToken {
+ return createPassword(identifier.getBytes(), masterKey);
+ }
+
+ @Override
+ public ApplicationTokenIdentifier createIdentifier() {
+ return new ApplicationTokenIdentifier();
+ }
+
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenSelector.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenSelector.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenSelector.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ApplicationTokenSelector.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,54 @@
+/**
+* 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.hadoop.yarn.security;
+
+import java.util.Collection;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.security.token.Token;
+import org.apache.hadoop.security.token.TokenIdentifier;
+import org.apache.hadoop.security.token.TokenSelector;
+
+public class ApplicationTokenSelector implements
+ TokenSelector<ApplicationTokenIdentifier> {
+
+ private static final Log LOG = LogFactory
+ .getLog(ApplicationTokenSelector.class);
+
+ @SuppressWarnings("unchecked")
+ public Token<ApplicationTokenIdentifier> selectToken(Text service,
+ Collection<Token<? extends TokenIdentifier>> tokens) {
+ if (service == null) {
+ return null;
+ }
+ LOG.info("Looking for a token with service " + service.toString());
+ for (Token<? extends TokenIdentifier> token : tokens) {
+ LOG.info("Token kind is " + token.getKind().toString()
+ + " and the token's service name is " + token.getService());
+ if (ApplicationTokenIdentifier.KIND_NAME.equals(token.getKind())
+ && service.equals(token.getService())) {
+ return (Token<ApplicationTokenIdentifier>) token;
+ }
+ }
+ return null;
+ }
+
+}
Added: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerManagerSecurityInfo.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerManagerSecurityInfo.java?rev=1082677&view=auto
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerManagerSecurityInfo.java (added)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerManagerSecurityInfo.java Thu Mar 17 20:21:13 2011
@@ -0,0 +1,54 @@
+/**
+* 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.hadoop.yarn.security;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.hadoop.security.KerberosInfo;
+import org.apache.hadoop.security.SecurityInfo;
+import org.apache.hadoop.security.token.TokenIdentifier;
+import org.apache.hadoop.security.token.TokenInfo;
+import org.apache.hadoop.security.token.TokenSelector;
+
+public class ContainerManagerSecurityInfo implements SecurityInfo {
+
+ @Override
+ public KerberosInfo getKerborosInfo(Class<?> protocol) {
+ return null;
+ }
+
+ @Override
+ public TokenInfo getTokenInfo(Class<?> protocol) {
+ return new TokenInfo() {
+
+ @Override
+ public Class<? extends Annotation> annotationType() {
+ return null;
+ }
+
+ @Override
+ public Class<? extends TokenSelector<? extends TokenIdentifier>>
+ value() {
+ return ContainerTokenSelector.class;
+ }
+ };
+
+ }
+
+}
\ No newline at end of file
|