blob: aa0d1699374a25c2cf45c272208daa25cf377453 [file] [log] [blame]
#!/bin/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 Apache MRQL in BSP mode using Apache Hama
#
#--------------------------------------------------------------------------------
MRQL_HOME="$(cd `dirname $0`/..; pwd -P)"
. "$MRQL_HOME/conf/mrql-env.sh"
GEN_JAR=`ls "$MRQL_HOME"/lib/mrql-gen-*.jar`
CORE_JAR=`ls "$MRQL_HOME"/lib/mrql-core-*.jar`
MRQL_JAR=`ls "$MRQL_HOME"/lib/mrql-bsp-*.jar`
FULL_JAR="/tmp/${USER}_mrql_bsp.jar"
CLASS_DIR="/tmp/${USER}_mrql_classes"
export JAVA_HOME FS_DEFAULT_NAME BSP_MASTER_ADDRESS HAMA_ZOOKEEPER_QUORUM BSP_SPLIT_INPUT
if [[ ($MRQL_JAR -nt $FULL_JAR) ]]; then
rm -rf $CLASS_DIR
mkdir -p $CLASS_DIR
pushd $CLASS_DIR > /dev/null
$JAVA_HOME/bin/jar xf $CUP_JAR
$JAVA_HOME/bin/jar xf $JLINE_JAR
$JAVA_HOME/bin/jar xf $GEN_JAR
$JAVA_HOME/bin/jar xf $CORE_JAR
$JAVA_HOME/bin/jar xf $MRQL_JAR
cd ..
$JAVA_HOME/bin/jar cf $FULL_JAR -C $CLASS_DIR .
popd > /dev/null
fi
if [ "$1" == "-local" ]; then
export HAMA_CLASSPATH=$FULL_JAR # needed for Hama 0.6.4 in local mode
$HAMA_HOME/bin/hama --config $HAMA_CONFIG jar $FULL_JAR org.apache.mrql.Main -bsp $*
else if [ "$1" == "-dist" ]; then
$HAMA_HOME/bin/hama --config $HAMA_CONFIG jar $FULL_JAR org.apache.mrql.Main -bsp $*
else
$JAVA_HOME/bin/java -classpath "$FULL_JAR:$HAMA_JAR:$HADOOP_JARS" org.apache.mrql.Main -bsp $*
fi
fi