You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mm...@apache.org on 2019/07/22 20:05:39 UTC

[accumulo-testing] branch master updated: Improve scripts (#91)

This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo-testing.git


The following commit(s) were added to refs/heads/master by this push:
     new edbc7cd  Improve scripts (#91)
edbc7cd is described below

commit edbc7cd153bf527022ce7c0a74a54c033898a61f
Author: Mike Miller <mm...@apache.org>
AuthorDate: Mon Jul 22 16:05:34 2019 -0400

    Improve scripts (#91)
    
    * Made scripts all call ./bin/build
    * Added check for env vars in env.sh
    * Print out where the env vars are coming from
---
 bin/agitator        | 7 +------
 bin/build           | 6 ++++--
 bin/cingest         | 7 +------
 bin/gcs             | 7 +------
 bin/mapred          | 7 +------
 bin/performance     | 1 +
 bin/rwalk           | 7 +------
 conf/env.sh.example | 9 +++++++++
 8 files changed, 19 insertions(+), 32 deletions(-)

diff --git a/bin/agitator b/bin/agitator
index bd2b445..c881d0f 100755
--- a/bin/agitator
+++ b/bin/agitator
@@ -17,6 +17,7 @@
 
 bin_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 at_home=$( cd "$( dirname "$bin_dir" )" && pwd )
+source "${bin_dir}/build"
 
 function print_usage() {
   cat <<EOF
@@ -29,12 +30,6 @@ Possible commands:
 EOF
 }
 
-if [ -f "$at_home/conf/env.sh" ]; then
-  . "$at_home"/conf/env.sh
-else
-  . "$at_home"/conf/env.sh.example
-fi
-
 function start_agitator() {
   hash pssh 2>/dev/null || { echo >&2 "The agitator requires pssh to be installed. Aborting."; exit 1; }
 
diff --git a/bin/build b/bin/build
index 97bbdd0..457e87a 100755
--- a/bin/build
+++ b/bin/build
@@ -19,7 +19,9 @@ bin_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 at_home=$( cd "$( dirname "$bin_dir" )" && pwd )
 
 if [ -f "$at_home/conf/env.sh" ]; then
-  . "$at_home"/conf/env.sh
+  conf="$at_home/conf/env.sh"
 else
-  . "$at_home"/conf/env.sh.example
+  conf="$at_home/conf/env.sh.example"
 fi
+echo "Using $conf for setup"
+source $conf
diff --git a/bin/cingest b/bin/cingest
index 58ac51e..84aa615 100755
--- a/bin/cingest
+++ b/bin/cingest
@@ -17,6 +17,7 @@
 
 bin_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 at_home=$( cd "$( dirname "$bin_dir" )" && pwd )
+source "${bin_dir}/build"
 
 function print_usage() {
   cat <<EOF
@@ -37,12 +38,6 @@ Available applications:
 EOF
 }
 
-if [ -f "$at_home/conf/env.sh" ]; then
-  . "$at_home"/conf/env.sh
-else
-  . "$at_home"/conf/env.sh.example
-fi
-
 if [ -z "$1" ]; then
   echo "ERROR: <application> needs to be set"
   print_usage
diff --git a/bin/gcs b/bin/gcs
index 611dad6..8014546 100755
--- a/bin/gcs
+++ b/bin/gcs
@@ -17,6 +17,7 @@
 
 bin_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 at_home=$( cd "$( dirname "$bin_dir" )" && pwd )
+source "${bin_dir}/build"
 
 function print_usage() {
   cat <<EOF
@@ -32,12 +33,6 @@ Available applications:
 EOF
 }
 
-if [ -f "$at_home/conf/env.sh" ]; then
-  . "$at_home"/conf/env.sh
-else
-  . "$at_home"/conf/env.sh.example
-fi
-
 if [ -z "$1" ]; then
   echo "ERROR: <application> needs to be set"
   print_usage
diff --git a/bin/mapred b/bin/mapred
index f943b45..fb6c82d 100755
--- a/bin/mapred
+++ b/bin/mapred
@@ -17,6 +17,7 @@
 
 bin_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 at_home=$( cd "$( dirname "$bin_dir" )" && pwd )
+source "${bin_dir}/build"
 
 function print_usage() {
   cat <<EOF
@@ -30,12 +31,6 @@ Available applications:
 EOF
 }
 
-if [ -f "$at_home/conf/env.sh" ]; then
-  . "$at_home"/conf/env.sh
-else
-  . "$at_home"/conf/env.sh.example
-fi
-
 if [ -z "$1" ]; then
   echo "ERROR: <application> needs to be set"
   print_usage
diff --git a/bin/performance b/bin/performance
index 20d8e8d..efcc68a 100755
--- a/bin/performance
+++ b/bin/performance
@@ -17,6 +17,7 @@
 
 bin_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 at_home=$( cd "$( dirname "$bin_dir" )" && pwd )
+source "${bin_dir}/build"
 at_version=2.0.0-SNAPSHOT
 
 function print_usage() {
diff --git a/bin/rwalk b/bin/rwalk
index caef893..9d54d34 100755
--- a/bin/rwalk
+++ b/bin/rwalk
@@ -17,6 +17,7 @@
 
 bin_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 at_home=$( cd "$( dirname "$bin_dir" )" && pwd )
+source "${bin_dir}/build"
 
 function print_usage() {
   cat <<EOF
@@ -30,12 +31,6 @@ EOF
   find "$at_home/src/main/resources/randomwalk/modules/." -name "*.xml" -printf "%f\n"
 }
 
-if [ -f "$at_home/conf/env.sh" ]; then
-  . "$at_home"/conf/env.sh
-else
-  . "$at_home"/conf/env.sh.example
-fi
-
 export CLASSPATH="$TEST_JAR_PATH:$HADOOP_API_JAR:$HADOOP_RUNTIME_JAR:$CLASSPATH"
 
 randomwalk_main="org.apache.accumulo.testing.randomwalk.Framework"
diff --git a/conf/env.sh.example b/conf/env.sh.example
index 780b09f..808ad1e 100644
--- a/conf/env.sh.example
+++ b/conf/env.sh.example
@@ -24,6 +24,15 @@ export ACCUMULO_HOME="${ACCUMULO_HOME:-/path/to/accumulo}"
 ## Path to Accumulo client properties
 export ACCUMULO_CLIENT_PROPS="$ACCUMULO_HOME/conf/accumulo-client.properties"
 
+if [ ! -d "$ACCUMULO_HOME" ]; then
+  echo "$ACCUMULO_HOME does not exist. Make sure to set ACCUMULO_HOME"
+  exit 1
+fi
+if [ ! -d "$HADOOP_HOME" ]; then
+  echo "$HADOOP_HOME does not exist. Make sure to set HADOOP_HOME"
+  exit 1
+fi
+
 # Add HADOOP conf directory to CLASSPATH, if set (for defaultFS in core-site.xml, etc.)
 if [[ -n $HADOOP_CONF_DIR ]]; then
   if [[ -z $CLASSPATH ]]; then