Author: tomwhite
Date: Fri Jun 26 13:40:07 2009
New Revision: 788699
URL: http://svn.apache.org/viewvc?rev=788699&view=rev
Log:
HADOOP-5925. EC2 scripts should exit on error.
Modified:
hadoop/common/trunk/CHANGES.txt
hadoop/common/trunk/src/contrib/ec2/bin/cmd-hadoop-cluster
hadoop/common/trunk/src/contrib/ec2/bin/create-hadoop-image
hadoop/common/trunk/src/contrib/ec2/bin/delete-hadoop-cluster
hadoop/common/trunk/src/contrib/ec2/bin/hadoop-ec2
hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-cluster
hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-master
hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-slaves
hadoop/common/trunk/src/contrib/ec2/bin/list-hadoop-clusters
hadoop/common/trunk/src/contrib/ec2/bin/terminate-hadoop-cluster
Modified: hadoop/common/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=788699&r1=788698&r2=788699&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Fri Jun 26 13:40:07 2009
@@ -465,6 +465,8 @@
commands that do not complete within a certain amount of time.
(Sreekanth Ramakrishnan via yhemanth)
+ HADOOP-5925. EC2 scripts should exit on error. (tomwhite)
+
OPTIMIZATIONS
HADOOP-5595. NameNode does not need to run a replicator to choose a
Modified: hadoop/common/trunk/src/contrib/ec2/bin/cmd-hadoop-cluster
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/contrib/ec2/bin/cmd-hadoop-cluster?rev=788699&r1=788698&r2=788699&view=diff
==============================================================================
--- hadoop/common/trunk/src/contrib/ec2/bin/cmd-hadoop-cluster (original)
+++ hadoop/common/trunk/src/contrib/ec2/bin/cmd-hadoop-cluster Fri Jun 26
13:40:07 2009
@@ -17,6 +17,8 @@
# Run commands on master or specified node of a running Hadoop EC2 cluster.
+set -o errexit
+
# if no args specified, show usage
if [ $# = 0 ]; then
echo "Command required!"
Modified: hadoop/common/trunk/src/contrib/ec2/bin/create-hadoop-image
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/contrib/ec2/bin/create-hadoop-image?rev=788699&r1=788698&r2=788699&view=diff
==============================================================================
--- hadoop/common/trunk/src/contrib/ec2/bin/create-hadoop-image (original)
+++ hadoop/common/trunk/src/contrib/ec2/bin/create-hadoop-image Fri Jun 26
13:40:07 2009
@@ -18,6 +18,8 @@
# Create a Hadoop AMI.
# Inspired by Jonathan Siegel's EC2 script
(http://blogsiegel.blogspot.com/2006/08/sandboxing-amazon-ec2.html)
+set -o errexit
+
# Import variables
bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
Modified: hadoop/common/trunk/src/contrib/ec2/bin/delete-hadoop-cluster
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/contrib/ec2/bin/delete-hadoop-cluster?rev=788699&r1=788698&r2=788699&view=diff
==============================================================================
--- hadoop/common/trunk/src/contrib/ec2/bin/delete-hadoop-cluster (original)
+++ hadoop/common/trunk/src/contrib/ec2/bin/delete-hadoop-cluster Fri Jun 26
13:40:07 2009
@@ -15,7 +15,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Delete the groups an local files associated with a cluster.
+# Delete the groups and local files associated with a cluster.
+
+set -o errexit
if [ -z $1 ]; then
echo "Cluster name required!"
@@ -42,17 +44,17 @@
rm -f $MASTER_IP_PATH
rm -f $MASTER_PRIVATE_IP_PATH
-ec2-describe-group | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null
-if [ $? -eq 0 ]; then
+if ec2-describe-group $CLUSTER_MASTER > /dev/null 2>&1; then
+ if ec2-describe-group $CLUSTER > /dev/null 2>&1; then
+ echo "Revoking authorization between $CLUSTER_MASTER and $CLUSTER"
+ ec2-revoke $CLUSTER_MASTER -o $CLUSTER -u $AWS_ACCOUNT_ID || true
+ ec2-revoke $CLUSTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID || true
+ fi
echo "Deleting group $CLUSTER_MASTER"
- ec2-revoke $CLUSTER_MASTER -o $CLUSTER -u $AWS_ACCOUNT_ID
+ ec2-delete-group $CLUSTER_MASTER
fi
-ec2-describe-group | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null
-if [ $? -eq 0 ]; then
+if ec2-describe-group $CLUSTER > /dev/null 2>&1; then
echo "Deleting group $CLUSTER"
- ec2-revoke $CLUSTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
+ ec2-delete-group $CLUSTER
fi
-
-ec2-delete-group $CLUSTER_MASTER
-ec2-delete-group $CLUSTER
Modified: hadoop/common/trunk/src/contrib/ec2/bin/hadoop-ec2
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/contrib/ec2/bin/hadoop-ec2?rev=788699&r1=788698&r2=788699&view=diff
==============================================================================
--- hadoop/common/trunk/src/contrib/ec2/bin/hadoop-ec2 (original)
+++ hadoop/common/trunk/src/contrib/ec2/bin/hadoop-ec2 Fri Jun 26 13:40:07 2009
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -o errexit
+
bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
Modified: hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-cluster
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-cluster?rev=788699&r1=788698&r2=788699&view=diff
==============================================================================
--- hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-cluster (original)
+++ hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-cluster Fri Jun 26
13:40:07 2009
@@ -17,6 +17,8 @@
# Launch an EC2 cluster of Hadoop instances.
+set -o errexit
+
# Import variables
bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
Modified: hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-master
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-master?rev=788699&r1=788698&r2=788699&view=diff
==============================================================================
--- hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-master (original)
+++ hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-master Fri Jun 26
13:40:07 2009
@@ -17,6 +17,8 @@
# Launch an EC2 Hadoop master.
+set -o errexit
+
if [ -z $1 ]; then
echo "Cluster name required!"
exit -1
@@ -46,8 +48,7 @@
exit 0
fi
-ec2-describe-group | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null
-if [ ! $? -eq 0 ]; then
+if ! ec2-describe-group $CLUSTER_MASTER > /dev/null 2>&1; then
echo "Creating group $CLUSTER_MASTER"
ec2-add-group $CLUSTER_MASTER -d "Group for Hadoop Master."
ec2-authorize $CLUSTER_MASTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
@@ -61,8 +62,7 @@
fi
fi
-ec2-describe-group | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null
-if [ ! $? -eq 0 ]; then
+if ! ec2-describe-group $CLUSTER > /dev/null 2>&1; then
echo "Creating group $CLUSTER"
ec2-add-group $CLUSTER -d "Group for Hadoop Slaves."
ec2-authorize $CLUSTER -o $CLUSTER -u $AWS_ACCOUNT_ID
@@ -105,8 +105,7 @@
echo $MASTER_EC2_ZONE > $MASTER_ZONE_PATH
while true; do
- REPLY=`ssh $SSH_OPTS "r...@$master_ec2_host" 'echo "hello"'`
- if [ ! -z $REPLY ]; then
+ if ssh $SSH_OPTS "r...@$master_ec2_host" 'echo "hello"' > /dev/null 2>&1;
then
break;
fi
sleep 5
Modified: hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-slaves
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-slaves?rev=788699&r1=788698&r2=788699&view=diff
==============================================================================
--- hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-slaves (original)
+++ hadoop/common/trunk/src/contrib/ec2/bin/launch-hadoop-slaves Fri Jun 26
13:40:07 2009
@@ -17,6 +17,8 @@
# Launch an EC2 Hadoop slaves.
+set -o errexit
+
if [ -z $1 ]; then
echo "Cluster name required!"
exit -1
Modified: hadoop/common/trunk/src/contrib/ec2/bin/list-hadoop-clusters
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/contrib/ec2/bin/list-hadoop-clusters?rev=788699&r1=788698&r2=788699&view=diff
==============================================================================
--- hadoop/common/trunk/src/contrib/ec2/bin/list-hadoop-clusters (original)
+++ hadoop/common/trunk/src/contrib/ec2/bin/list-hadoop-clusters Fri Jun 26
13:40:07 2009
@@ -17,6 +17,8 @@
# List running clusters.
+set -o errexit
+
# Import variables
bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
Modified: hadoop/common/trunk/src/contrib/ec2/bin/terminate-hadoop-cluster
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/contrib/ec2/bin/terminate-hadoop-cluster?rev=788699&r1=788698&r2=788699&view=diff
==============================================================================
--- hadoop/common/trunk/src/contrib/ec2/bin/terminate-hadoop-cluster (original)
+++ hadoop/common/trunk/src/contrib/ec2/bin/terminate-hadoop-cluster Fri Jun 26
13:40:07 2009
@@ -17,6 +17,8 @@
# Terminate a cluster.
+set -o errexit
+
if [ -z $1 ]; then
echo "Cluster name required!"
exit -1