@@ -18,6 +18,8 @@ get_abs_script_path() {
18
18
19
19
get_abs_script_path
20
20
21
+ . $appdir /setenv.sh
22
+
21
23
GC_OPTS=" -XX:+UseConcMarkSweepGC
22
24
-verbose:gc -XX:+PrintGCTimeStamps -Xloggc:$appdir /gc.out
23
25
-XX:MaxPermSize=512m
@@ -26,7 +28,7 @@ GC_OPTS="-XX:+UseConcMarkSweepGC
26
28
# To truly enable JMX in AWS and other containerized environments, also need to set
27
29
# -Djava.rmi.server.hostname equal to the hostname in that environment. This is specific
28
30
# depending on AWS vs GCE etc.
29
- JAVA_OPTS=" -XX:MaxDirectMemorySize=512M \
31
+ JAVA_OPTS=" -XX:MaxDirectMemorySize=$MAX_DIRECT_MEMORY \
30
32
-XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true \
31
33
-Dcom.sun.management.jmxremote.port=9999 \
32
34
-Dcom.sun.management.jmxremote.rmi.port=9999 \
@@ -35,89 +37,20 @@ JAVA_OPTS="-XX:MaxDirectMemorySize=512M \
35
37
36
38
MAIN=" spark.jobserver.JobServer"
37
39
38
- if [ -f " $JOBSERVER_CONFIG " ]; then
39
- conffile=" $JOBSERVER_CONFIG "
40
- else
41
- conffile=$( ls -1 $appdir /* .conf | head -1)
42
- if [ -z " $conffile " ]; then
43
- echo " No configuration file found"
44
- exit 1
45
- fi
46
- fi
47
-
48
- if [ -f " $appdir /settings.sh" ]; then
49
- . " $appdir /settings.sh"
50
- else
51
- echo " Missing $appdir /settings.sh, exiting"
52
- exit 1
53
- fi
54
-
55
- if [ -z " $SPARK_HOME " ]; then
56
- echo " Please set SPARK_HOME or put it in $appdir /settings.sh first"
57
- exit 1
58
- fi
59
-
60
- pidFilePath=$appdir /$PIDFILE
61
-
62
- if [ -f " $pidFilePath " ] && kill -0 " $( cat " $pidFilePath " ) " ; then
40
+ PIDFILE=$appdir /spark-jobserver.pid
41
+ if [ -f " $PIDFILE " ] && kill -0 $( cat " $PIDFILE " ) ; then
63
42
echo ' Job server is already running'
64
43
exit 1
65
44
fi
66
45
67
- if [ -z " $LOG_DIR " ]; then
68
- LOG_DIR=/tmp/job-server
69
- echo " LOG_DIR empty; logging will go to $LOG_DIR "
70
- fi
71
- mkdir -p $LOG_DIR
72
-
73
- LOGGING_OPTS=" -DLOG_DIR=$LOG_DIR "
74
-
75
- export SPARK_SUBMIT_LOGBACK_CONF_FILE=" $appdir /logback-server.xml"
76
-
77
- # For Mesos
78
- CONFIG_OVERRIDES=" "
79
- if [ -n " $SPARK_EXECUTOR_URI " ]; then
80
- CONFIG_OVERRIDES=" -Dspark.executor.uri=$SPARK_EXECUTOR_URI "
81
- fi
82
- # For Mesos/Marathon, use the passed-in port
83
- if [ " $PORT " != " " ]; then
84
- CONFIG_OVERRIDES+=" -Dspark.jobserver.port=$PORT "
85
- fi
86
-
87
- if [ -z " $JOBSERVER_MEMORY " ]; then
88
- JOBSERVER_MEMORY=1G
89
- fi
90
-
91
- # This needs to be exported for standalone mode so drivers can connect to the Spark cluster
92
- export SPARK_HOME
93
- export YARN_CONF_DIR
94
- export HADOOP_CONF_DIR
95
-
96
- # Identify location of dse command
97
- DSE=" /usr/bin/dse"
98
- if [ -z " $DSE_HOME " ]; then
99
- if [ -e " $DSE " ]; then
100
- export DSE_HOME=/usr/share/dse
101
- fi
102
- fi
103
- if [ ! -e " $DSE " ]; then
104
- if [ -e " $DSE_HOME " /bin/dse ]; then
105
- DSE=" $DSE_HOME " /bin/dse
106
- else
107
- echo " Cannot determine DSE_HOME, please set it manually to your DSE install directory"
108
- exit 1
109
- fi
110
- fi
111
-
112
- # Submit the job server
113
- cmd=' $DSE spark-submit --class $MAIN --driver-memory $JOBSERVER_MEMORY
46
+ cmd=' $SPARK_HOME/bin/spark-submit --class $MAIN --driver-memory $JOBSERVER_MEMORY
114
47
--conf "spark.executor.extraJavaOptions=$LOGGING_OPTS"
115
48
--driver-java-options "$GC_OPTS $JAVA_OPTS $LOGGING_OPTS $CONFIG_OVERRIDES"
116
49
$@ $appdir/spark-job-server.jar $conffile'
117
50
118
51
if [ -z " $JOBSERVER_FG " ]; then
119
- eval $cmd 2>&1 &
120
- echo $! > $pidFilePath
52
+ eval $cmd > /dev/null 2>&1 < /dev/null &
53
+ echo $! > $PIDFILE
121
54
else
122
55
eval $cmd
123
56
fi
0 commit comments