-
Notifications
You must be signed in to change notification settings - Fork 380
/
Copy pathceleborn-class
executable file
·101 lines (86 loc) · 3.16 KB
/
celeborn-class
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/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.
#
if [ -z "${CELEBORN_HOME}" ]; then
export CELEBORN_HOME="$(cd "`dirname "$0"`"/..; pwd)"
fi
export CELEBORN_CONF_DIR="${CELEBORN_CONF_DIR:-"${CELEBORN_HOME}/conf"}"
# print launch command for debug
export CELEBORN_PRINT_LAUNCH_COMMAND="0"
if [ -z "$CELEBORN_ENV_LOADED" ]; then
export CELEBORN_ENV_LOADED=1
if [ -f "${CELEBORN_CONF_DIR}/celeborn-env.sh" ]; then
# Promote all variable declarations to environment (exported) variables
set -a
. "${CELEBORN_CONF_DIR}/celeborn-env.sh"
set +a
fi
fi
# Find CELEBORN jars.
for i in "$@"
do
if [ "$i" == "org.apache.celeborn.service.deploy.master.Master" ] ; then
LAUNCH_CLASS=org.apache.celeborn.service.deploy.master.Master
fi
if [ "$i" == "org.apache.celeborn.service.deploy.worker.Worker" ] ; then
LAUNCH_CLASS=org.apache.celeborn.service.deploy.worker.Worker
fi
if [ "$i" == "org.apache.celeborn.cli.CelebornCli" ] ; then
LAUNCH_CLASS=org.apache.celeborn.cli.CelebornCli
fi
done
if [ "${LAUNCH_CLASS}" == "org.apache.celeborn.service.deploy.master.Master" ] ; then
if [ -d "${CELEBORN_HOME}/master-jars" ]; then
CELEBORN_JARS_DIR="${CELEBORN_HOME}/master-jars"
else
CELEBORN_JARS_DIR="${CELEBORN_HOME}/master/target"
fi
fi
if [ "${LAUNCH_CLASS}" == "org.apache.celeborn.service.deploy.worker.Worker" ] ; then
if [ -d "${CELEBORN_HOME}/worker-jars" ]; then
CELEBORN_JARS_DIR="${CELEBORN_HOME}/worker-jars"
else
CELEBORN_JARS_DIR="${CELEBORN_HOME}/worker/target"
fi
fi
if [ "${LAUNCH_CLASS}" == "org.apache.celeborn.cli.CelebornCli" ] ; then
if [ -d "${CELEBORN_HOME}/cli-jars" ]; then
CELEBORN_JARS_DIR="${CELEBORN_HOME}/cli-jars"
else
CELEBORN_JARS_DIR="${CELEBORN_HOME}/cli/target"
fi
fi
if [ ! -d "$CELEBORN_JARS_DIR" ]; then
echo "Failed to find CELEBORN jars directory ($CELEBORN_JARS_DIR)." 1>&2
echo "You need to build CELEBORN with the target \"package\" before running this program." 1>&2
exit 1
else
CELEBORN_CLASSPATH="$CELEBORN_CONF_DIR:$HADOOP_CONF_DIR:$CELEBORN_JARS_DIR/*:$JAVA_TOOLS_JAR"
fi
# Turn off posix mode since it does not allow process substitution
set +o posix
CMD=()
CMD+=("$JAVA")
CMD=(${CMD[@]} "-XX:+IgnoreUnrecognizedVMOptions" "$CELEBORN_JAVA_OPTS")
CMD+=("-cp")
CMD+=("$CELEBORN_CLASSPATH")
CMD=(${CMD[@]} "$@")
COUNT=${#CMD[@]}
if [ "${CELEBORN_PRINT_LAUNCH_COMMAND}" = "1" ]; then
echo "Start to launch ${CMD[@]}"
fi
exec "${CMD[@]}"