blob: 40d7777fe24d4af3e3e699c04af3b31c21c25dcc [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 Apache Flink mode
#
#--------------------------------------------------------------------------------
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-flink-*.jar`
FULL_JAR="/tmp/${USER}_mrql_flink.jar"
CLASS_DIR="/tmp/${USER}_mrql_classes"
export FLINK_HOME FLINK_JARS FLINK_MASTER FS_DEFAULT_NAME
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
$JAVA_HOME/bin/jar xf $HDFS_JAR
cd ..
$JAVA_HOME/bin/jar cf $FULL_JAR -C $CLASS_DIR .
popd > /dev/null
fi
if [ "$1" == "-dist" ]; then
if ([ -a $FLINK_HOME/conf/.yarn-jobmanager ]); then
export FLINK_MASTER=`cat $FLINK_HOME/conf/.yarn-jobmanager`
fi
if ([ -a $FLINK_HOME/conf/.yarn-properties ]); then
. $FLINK_HOME/conf/.yarn-properties
export FLINK_MASTER=$jobManager
fi
args=" -flink $*"
args=${args// /\!}
$FLINK_HOME/bin/flink run $FULL_JAR -c org.apache.mrql.Main -v args $args
else
$JAVA_HOME/bin/java -classpath "$FULL_JAR:$FLINK_JARS" org.apache.mrql.Main -flink $*
fi