Commit 8dba8c4f authored by Georgios Ouzounis's avatar Georgios Ouzounis
Browse files

LAM-49 Implemented stop method in Apache Flink init file.

parent 47bf88e9
...@@ -12,19 +12,20 @@ LOCKFILE="$INSTALLATION_PATH/flink/flink-lock" ...@@ -12,19 +12,20 @@ LOCKFILE="$INSTALLATION_PATH/flink/flink-lock"
# The command that will start Apache Flink. # The command that will start Apache Flink.
START_COMMAND="$INSTALLATION_PATH/flink/bin/yarn-session.sh -n {{ number_of_taskmanagers }} -tm {{ ram_per_task_manager }}" START_COMMAND="$INSTALLATION_PATH/flink/bin/yarn-session.sh -n {{ number_of_taskmanagers }} -tm {{ ram_per_task_manager }}"
# The stop function, will not stop Apache Flink. The best way to stop Apache Flink running on an Apache Yarn session, is to # The command that will stop Apache Flink. Note that, HADOOP_HOME home variable should be set outside from this script and
# stop the Apache Yarn session itself. # before Flink's deployment.
STOP_COMMAND="$HADOOP_HOME/bin/yarn application --kill"
start(){ start(){
touch $PIDFILE nohup $START_COMMAND &
nohup $START_COMMAND & echo $! > $PIDFILE
RETVAL=$? RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE [ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL return $RETVAL
} }
stop(){ stop(){
kill -s 9 $(cat $PIDFILE) id=$($HADOOP_HOME/bin/yarn application --list | grep "Flink session" | cut -f1)
nohup $STOP_COMMAND $id &
RETVAL=$? RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE) [ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
return $RETVAL return $RETVAL
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment