forked from h2oai/h2o-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename to loggers to avoid accidental kill (ensures logging stops)
- Loading branch information
1 parent
197d31c
commit e7085ef
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
|
||
#ssh into each of the machines from ${JSON} (passed as first argument) | ||
MACHINES=`cat BMscripts/$1 | python -c 'import sys, json; print json.load(sys.stdin)[sys.argv[1]]' ip | awk -F, 'OFS="," {gsub("[ u\x27\[\]]","", $0); print}'` | ||
IFS="," | ||
MACHINES=($MACHINES) | ||
|
||
function startBigLoggers { | ||
for i in ${MACHINES[@]} | ||
do | ||
echo "Starting bigLogger on ${i}" | ||
scp BMLogs/starttime spencer@$i:/home/spencer/h2o/bench/BMLogs | ||
ssh spencer@$i "cd /home/spencer/h2o/bench/BMLogs; bash bigLogger.sh" & | ||
done | ||
} | ||
|
||
function startLittleLoggers { | ||
for i in ${MACHINES[@]} | ||
do | ||
echo "Starting littleLogger on ${i} on phase $1" | ||
ssh spencer@$i "cd /home/spencer/h2o/bench/BMLogs; bash littleLogger.sh $1" & | ||
done | ||
} | ||
|
||
function stopLittleLoggers { | ||
for i in ${MACHINES[@]} | ||
do | ||
"Stopping little loggers on machine $i" | ||
pids=`echo spencer@$i ps ax|grep bash|grep littleLogger|awk '{print $1}'| xargs` | ||
ssh spencer@$i kill $pids | ||
done | ||
} | ||
|
||
function stopAllLoggers { | ||
for i in ${MACHINES[@]} | ||
do | ||
"Stopping all loggers on machine $i" | ||
pids=`echo ssh spencer@$i ps ax|grep bash|grep Logger|awk '{print $1}'| xargs` | ||
ssh spencer@$i kill $pids | ||
done | ||
} | ||
|
||
function changePhase { | ||
echo "Stopping little loggers" | ||
stopLittleLoggers >/dev/null | ||
newPhase=$1 | ||
startLittleLoggers $1 >/dev/null | ||
} | ||
|
||
if [ $2 = "big" ] | ||
then | ||
startBigLoggers >/dev/null | ||
fi | ||
|
||
if [ $2 = "little" ] | ||
then | ||
startLittleLoggers START >/dev/null | ||
fi | ||
|
||
if [ $2 = "changePhase" ] | ||
then | ||
changePhase $3 >/dev/null | ||
fi | ||
|
||
if [ $2 = "stop_" ] | ||
then | ||
stopAllLoggers | ||
fi |