Skip to content

Instantly share code, notes, and snippets.

@chenyanzhe
Created December 29, 2013 13:18
Show Gist options
  • Save chenyanzhe/8170405 to your computer and use it in GitHub Desktop.
Save chenyanzhe/8170405 to your computer and use it in GitHub Desktop.
MapMatch launcher scripts adapted from Spark run-example script
#!/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.
#
FWDIR="$(cd `dirname $0`; pwd)"
LAUNCHER="$FWDIR/run-mapmatch"
ENTRY="com.hp.hpl.traffic.mapmatch.MapMatch"
GISCUP_DIR="/home/yanzhe/MapMatch/data/GIS12cup"
MAP_DIR="$GISCUP_DIR/Map"
INPUT_DIR="$GISCUP_DIR/data23/input"
OUTPUT_DIR="$GISCUP_DIR/data23/output"
exec $LAUNCHER $ENTRY spark://brick10:7077 $MAP_DIR $INPUT_DIR $OUTPUT_DIR
#!/usr/bin/env 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.
#
SCALA_VERSION=2.9.3
# Figure out where the Spark framework is installed
SPARK_DIR=/home/yanzhe/spark-0.8.1-incubating
# Export this as SPARK_HOME
export SPARK_HOME="$SPARK_DIR"
# Load environment variables from conf/spark-env.sh, if it exists
if [ -e $SPARK_DIR/conf/spark-env.sh ] ; then
. $SPARK_DIR/conf/spark-env.sh
fi
if [ -z "$1" ]; then
echo "Usage: run-mapmatch <main-class> [<args>]" >&2
exit 1
fi
# Figure out the JAR file that MapMatch was packaged into.
MAPMATCH_DIR="$(cd `dirname $0`; pwd)"
export MAPMATCH_JAR="$MAPMATCH_DIR/MapMatch.jar"
if [[ -z $MAPMATCH_JAR ]]; then
echo "Failed to find MapMatch jar package in $MAPMATCH_DIR" >&2
exit 1
fi
# add standard Spark classpath, built using compute-classpath.sh
CLASSPATH=`$SPARK_DIR/bin/compute-classpath.sh`
CLASSPATH="$MAPMATCH_JAR:$CLASSPATH"
# Find java binary
if [ -n "${JAVA_HOME}" ]; then
RUNNER="${JAVA_HOME}/bin/java"
else
if [ `command -v java` ]; then
RUNNER="java"
else
echo "JAVA_HOME is not set" >&2
exit 1
fi
fi
if [ "$SPARK_PRINT_LAUNCH_COMMAND" == "1" ]; then
echo -n "Spark Command: "
echo "$RUNNER" -cp "$CLASSPATH" "$@"
echo "========================================"
echo
fi
exec "$RUNNER" -cp "$CLASSPATH" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment