Skip to content

Commit

Permalink
Merge pull request linkedin#5 from akshayrai/confDirFix
Browse files Browse the repository at this point in the history
LIHADOOP-18919: Investigate and fix why Dr. Elephant configurations a…
  • Loading branch information
akshayrai committed Apr 8, 2016
2 parents 7753b26 + 4075d07 commit d71e1da
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
4 changes: 1 addition & 3 deletions app/com/linkedin/drelephant/ElephantRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public void run() {
_hadoopSecurity.doAs(new PrivilegedAction<Void>() {
@Override
public Void run() {
//TODO: We need to catch exception here
HDFSContext.load();
loadAnalyticJobGenerator();
ElephantContext.init();
Expand Down Expand Up @@ -124,10 +123,9 @@ public Void run() {
return null;
}
});
} catch (IOException e) {
} catch (Exception e) {
logger.error(e.getMessage());
logger.error(ExceptionUtils.getStackTrace(e));
logger.error("Error on Hadoop Security setup. Failed to login with Kerberos");
}
}

Expand Down
28 changes: 18 additions & 10 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
# the License.
#

function print_usage(){
echo "usage: ./start.sh PATH_TO_CONFIG_DIR(optional)"
function print_usage() {
echo "usage: ./start.sh PATH_TO_APP_CONFIG_DIR(optional, if you have already set env variable ELEPHANT_CONF_DIR)"
}

function check_config(){
if [ -z "${!1}" ];
then
function check_config() {
if [ -z "${!1}" ]; then
echo "error: ${1} must be present in the config file."
check=0
else
Expand All @@ -31,8 +30,8 @@ function check_config(){
}

# Save project root dir
script_dir=`which $0`
script_dir=`dirname $script_dir`
script_path=`which $0`
script_dir=`dirname $script_path`
project_root=$script_dir/../

# User could set an environmental variable, ELEPHANT_CONF_DIR, or pass an optional argument(config file path)
Expand All @@ -47,14 +46,23 @@ if [ -z "$1" ]; then
else
CONF_DIR=$1
fi
echo "Using config dir: "$CONF_DIR

CONFIG_FILE=$CONF_DIR"/elephant.conf"
echo "Using config file: "$CONFIG_FILE
# Verify and get absolute path to conf
if [ -d "$CONF_DIR" ]; then
CONF_DIR=`cd "$CONF_DIR";pwd`
echo "Using config dir: $CONF_DIR"
else
echo "error: ${1} is not a directory or it does not exist. Please specify the application's configuration directory(app-conf)"
print_usage
exit 1
fi

# set/update env variable so Dr. run script will use this dir and load all confs into classpath
export ELEPHANT_CONF_DIR=$CONF_DIR

CONFIG_FILE=$ELEPHANT_CONF_DIR"/elephant.conf"
echo "Using config file: "$CONFIG_FILE

# User must give a valid file as argument
if [ -f $CONFIG_FILE ];
then
Expand Down

0 comments on commit d71e1da

Please sign in to comment.