Skip to content

Commit 2602ae2

Browse files
committed
work on #2425 : added a SingleJVM mode and support for update.rc-d
- the proactive-scheduler service can now start nodes in SingleJVM mode (multiple ProActive Nodes for one JVM) - Make use of update.rc-d when the use of chkconfig fails (cherry picked from commit ec5414d)
1 parent 8855faf commit 2602ae2

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

tools/install.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ read -e -p "Port used by the proactive server: " -i "8080" PORT
8888
PORT=$(echo $PORT | xargs)
8989

9090
read -e -p "Number of ProActive nodes to start on the server machine: " -i "4" NB_NODES
91-
9291
NB_NODES=$(echo $NB_NODES | xargs)
9392

9493
if confirm "Setup cron task for cleaning old logs? [Y/n] " ; then
@@ -114,6 +113,10 @@ sed "s/PORT=.*/PORT=$PORT/g" -i "/etc/init.d/proactive-scheduler"
114113
sed "s/NB_NODES=.*/NB_NODES=$NB_NODES/g" -i "/etc/init.d/proactive-scheduler"
115114
sed "s/PA_ROOT=.*/PA_ROOT=$(escape_rhs_sed "$PA_ROOT")/g" -i "/etc/init.d/proactive-scheduler"
116115

116+
if confirm "Start ProActive Nodes in a single JVM process (y) or multiple JVM Processes (n) ? [Y/n] " ; then
117+
sed "s/SINGLE_JVM=.*/SINGLE_JVM=true/g" -i "/etc/init.d/proactive-scheduler"
118+
fi
119+
117120
chmod 700 /etc/init.d/proactive-scheduler
118121

119122
mkdir -p /var/log/proactive
@@ -122,7 +125,11 @@ touch /var/log/proactive/scheduler
122125
chown -R $USER:$USER /var/log/proactive
123126

124127
if confirm "Start the proactive-scheduler service at startup? [Y/n] " ; then
125-
chkconfig proactive-scheduler on
128+
if chkconfig proactive-scheduler on 2> /dev/null ; then
129+
echo "proactive-scheduler service added as a startup daemon"
130+
else
131+
update-rc.d proactive-scheduler defaults
132+
fi
126133
fi
127134

128135

tools/proactive-scheduler

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ PORT=8080
1616
NB_NODES=1
1717
ALIAS=$(hostname)
1818
PA_ROOT=/opt/proactive
19+
SINGLE_JVM=false
1920

2021

2122
# e,d of variables to modify
@@ -26,15 +27,21 @@ export PROACTIVE_HOME=$PA_ROOT/default
2627
NAME=proactive-scheduler
2728
#THE COMMAND TO LAUNCH
2829

29-
DAEMON="$PROACTIVE_HOME/bin/proactive-server -ln $NB_NODES"
30+
if $SINGLE_JVM ; then
31+
DAEMON="$PROACTIVE_HOME/bin/proactive-server -ln 0"
32+
else
33+
DAEMON="$PROACTIVE_HOME/bin/proactive-server -ln $NB_NODES"
34+
fi
3035

3136
#File where log will be placed (/dev/null if empty)
3237
LOGFILE=/var/log/proactive/scheduler
3338
#File where pid will be store, leave as is if you don't know what you do
3439
PIDFILE=/var/run/$NAME.pid
40+
NODE_PIDFILE=/var/run/$NAME_node.pid
3541

3642
REST_URL=$PROTOCOL://localhost:$PORT/rest
3743
REST_PUBLIC_URL=$PROTOCOL://${ALIAS}:$PORT/rest
44+
PA_URL=pnp://${ALIAS}:64738
3845

3946
processRunning() {
4047
kill -0 $1 &> /dev/null
@@ -68,6 +75,29 @@ waitForCompletion() {
6875
done
6976
}
7077

78+
createnodes() {
79+
echo Creating local nodes ...
80+
PA_PROTOCOL=$(grep 'proactive.communication.protocol' "$PROACTIVE_HOME/config/network/server.ini" | sed "s/proactive\.communication\.protocol=\(.*\)/\1/g")
81+
if [[ "$PA_PROTOCOL" == "pnp" ]]; then
82+
PA_URL=pnp://${ALIAS}:64738
83+
elif [[ "$PA_PROTOCOL" == "pamr" ]]; then
84+
PA_URL=pamr://0
85+
else
86+
PA_URL=pnp://${ALIAS}:64738
87+
fi
88+
89+
CMD="nohup $PROACTIVE_HOME/bin/proactive-node -w $NB_NODES -f $PROACTIVE_HOME/config/authentication/rm.cred -s Default -r $PA_URL &> /dev/null & "
90+
if [ "$USER" != "" ]
91+
then
92+
$(su $USER -c "$CMD")
93+
else
94+
$(su -c "cd $PROACTIVE_HOME/bin && $CMD")
95+
fi
96+
CURRPID=$(ps aux|grep RMNodeStarter|grep -v "grep"|awk '{ print $2 }')
97+
echo $CURRPID > $NODE_PIDFILE
98+
}
99+
100+
71101

72102

73103
start() {
@@ -110,6 +140,10 @@ start() {
110140
done
111141
echo Web interfaces started at $PROTOCOL://${ALIAS}:$PORT
112142

143+
if $SINGLE_JVM ; then
144+
createnodes
145+
fi
146+
113147
echo -e "Service $NAME \e[0;32mSTARTED\e[0m"
114148

115149
else
@@ -131,6 +165,10 @@ stop() {
131165
then
132166
# kill scheduler process
133167
kill $CURRPID
168+
if $SINGLE_JVM ; then
169+
NODEPID=$(cat $NODE_PIDFILE)
170+
kill $NODEPID
171+
fi
134172
waitForCompletion
135173
echo -e "Service $NAME : \e[0;31mSTOPPED\e[0m"
136174
else

0 commit comments

Comments
 (0)