-
Notifications
You must be signed in to change notification settings - Fork 2
/
hammr-helper
executable file
·132 lines (101 loc) · 4.52 KB
/
hammr-helper
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/sh
# Edit these definitions
MANAGER_DIR=$(pwd)/Experiments
CLIENT_DIR=$(pwd)/Experiments/WordCount
REGISTRYLOC=localhost
# You probably do not need to edit these definitions
BASEDIR=`pwd`
RUNNINGDIR=pwd
COMMONDIR="$BASEDIR/Common/bin/"
LIBDIR="$BASEDIR/lib/"
JGRAPHFILE="$LIBDIR/jgrapht-jdk1.6.jar"
HADOOPFILE="$LIBDIR/hadoop-0.20.2-core.jar"
BINDIRS=$COMMONDIR:$BASEDIR/Client/bin:$BASEDIR/Launcher/bin:$BASEDIR/Manager/bin
# We are memory hungry! Reserve heap space for the JVM
HEAPPARAMS="-XX:-UseGCOverheadLimit -Xms2500M -Xmx2500M"
KEYSTORE="$BASEDIR/Common/keystore"
KEYSTORE_PWD="123456"
TRUSTSTORE="$BASEDIR/Common/truststore"
TRUSTSTORE_PWD="123456"
LAUNCHER_USER_RESTRICTIONS="-Dhammr.launcher.user_restrictions=''"
LAUNCHER_APPLICATION_RESTRICTIONS="-Dhammr.launcher.application_restrictions=''"
LAUNCHER_NODE_RESTRICTIONS="-Dhammr.launcher.node_restrictions=''"
LAUNCHER_COLLOCATION_STATUS="-Dhammr.launcher.collocation_status=''"
LAUNCHER_FLAGS=""
#LAUNCHER_FLAGS="$LAUNCHER_USER_RESTRICTIONS $LAUNCHER_APPLICATION_RESTRICTIONS $LAUNCHER_NODE_RESTRICTIONS $LAUNCHER_COLLOCATION_STATUS"
export CODEBASE="file://${BASEDIR}/Common/bin/"
export CLASSPATH=$BINDIRS:$JGRAPHFILE:$HADOOPFILE
Compile() {
ant -buildfile $BASEDIR/Common/build.xml && \
ant -buildfile $BASEDIR/Client/build.xml && \
ant -buildfile $BASEDIR/Manager/build.xml && \
ant -buildfile $BASEDIR/Launcher/build.xml && \
mkdir $COMMONDIR/org && \
cp -r $LIBDIR/jgrapht-org/jgrapht $COMMONDIR/org
}
Clean() {
ant -buildfile $BASEDIR/Common/build.xml clean
ant -buildfile $BASEDIR/Client/build.xml clean
ant -buildfile $BASEDIR/Manager/build.xml clean
ant -buildfile $BASEDIR/Launcher/build.xml clean
}
CheckRMIRegistry() {
if ps ax | grep rmiregistry | grep -v grep > /dev/null
then
echo "Registry running -> continuing"
else
echo "Registry not running -> giving up"
exit
fi
}
RunManager() {
CheckRMIRegistry
echo "Running manager: codebase=${CODEBASE} and registry=${REGISTRYLOC}"
echo "You should have alredy run \"rmiregistry\" on machine ${REGISTRYLOC}"
java -cp $CLASSPATH $HEAPPARAMS -Dhammr.manager.basedir=$MANAGER_DIR -Djava.rmi.server.location=$REGISTRYLOC -Djava.rmi.server.codebase=$CODEBASE -Djava.security.policy=$BASEDIR/Manager/security.policy manager.ConcreteManager $@
}
RunLauncher() {
echo "Running launcher: codebase=${CODEBASE} and registry=${REGISTRYLOC}"
java -cp $CLASSPATH $HEAPPARAMS -Djava.rmi.server.location=$REGISTRYLOC -Djava.rmi.server.codebase=$CODEBASE -Djava.security.policy=$BASEDIR/Launcher/security.policy $LAUNCHER_FLAGS launcher.ConcreteLauncher $@
}
RunTest() {
echo "Running client: codebase=${CODEBASE} and registry=${REGISTRYLOC}"
java -cp $CLASSPATH $HEAPPARAMS -Dhammr.client.basedir=$CLIENT_DIR -Djava.rmi.server.location=$REGISTRYLOC -Djava.rmi.server.codebase=$CODEBASE -Djava.security.policy=$BASEDIR/Client/security.policy client.TestClient $@
}
RunWordCount() {
echo "Running wordcount: codebase=${CODEBASE} and registry=${REGISTRYLOC}"
java -cp $CLASSPATH $HEAPPARAMS -Dhammr.client.basedir=$CLIENT_DIR -Djava.rmi.server.location=$REGISTRYLOC -Djava.rmi.server.codebase=$CODEBASE -Djava.security.policy=$BASEDIR/Client/security.policy client.MapReduceClient $@
}
RunShortestPath() {
echo "Running shortestpath: codebase=${CODEBASE} and registry=${REGISTRYLOC}"
java -cp $CLASSPATH $HEAPPARAMS -Dhammr.client.basedir=$CLIENT_DIR -Djava.rmi.server.location=$REGISTRYLOC -Djava.rmi.server.codebase=$CODEBASE -Djava.security.policy=$BASEDIR/Client/security.policy client.ShortestPathClient $@
}
RunGenInput() {
echo "Running the input generator"
java -cp $CLASSPATH $HEAPPARAMS utilities.counting.CountingInputGenerator $@
}
RunGenOutput() {
echo "Running the output extractor"
java -cp $CLASSPATH $HEAPPARAMS utilities.counting.CountingOutputExtractor $@
}
Kill() {
killall -9 rmiregistry 2>/dev/null
ps ax -o pid,command | grep ConcreteManager | grep -v grep | xargs kill -9 2>/dev/null
ps ax -o pid,command | grep ConcreteLauncher | grep -v grep | xargs kill -9 2>/dev/null
}
COMMAND=$1; shift;
case "${COMMAND}" in
classpath) echo $CLASSPATH ;;
compile) Compile $@ ;;
clean) Clean $@ ;;
manager) RunManager $@ ;;
launcher) RunLauncher $@ ;;
test) RunTest $@ ;;
wordcount) RunWordCount $@ ;;
shortestpath) RunShortestPath $@ ;;
gen_input) RunGenInput $@ ;;
gen_output) RunGenOutput $@ ;;
kill) Kill $@ ;;
*) echo "Unrecognized command"; exit 1; ;;
esac
exit 0