-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·69 lines (52 loc) · 1.89 KB
/
run.sh
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
#!/usr/bin/env bash
### Functions
##
# @desc NA
##
function Hadoop () {
# Grab Arguments
files=$1
inDir=$2
outDir=$3
mapper=$4
reducer=$5
# Run Hadoop
hadoop \
jar /usr/lib/hadoop-mapreduce/hadoop-streaming.jar \
-files ${files} \
-input ${inDir} \
-output ${outDir} \
-mapper ${mapper} \
-reducer ${reducer}
return 0
}
### Main Execution
# Check Arguments Length
if [ $# -eq 0 ]; then
echo "USAGE: ./run.py [OPTION]\n"
exit 1
fi
# Check Which Hadoop to Run
if [ "$1" = "Hosts" ]; then
Hadoop "htmltohosts.py" "/public/www.2021" "/users/jquinn13/Hosts" "htmltohosts.py" "NONE"
elif [ "$1" = "Words" ]; then
Hadoop "htmltowords.py" "/public/www.2021" "/users/jquinn13/Words" "htmltowords.py" "NONE"
elif [ "$1" = "HostWords" ]; then
Hadoop "htmltowords.py" "/public/www.2021" "/users/jquinn13/HostWords" "htmltohosts.py -h" "NONE"
elif [ "$1" = "WordCount" ]; then
Hadoop "WordCountMap.py,WordCountReduce.py" "/users/jquinn13/Words" "/users/jquinn13/WordCount" "WordCountMap.py" "WordCountReduce.py"
elif [ "$1" = "Bigrams" ]; then
Hadoop "BigramsMap.py,BigramsReduce.py" "/users/jquinn13/Words" "/users/jquinn13/Bigrams" "BigramsMap.py" "BigramsReduce.py"
elif [ "$1" = "InvertedIndex" ]; then
Hadoop "InvertedIndexMap.py,InvertedIndexReduce.py" "/users/jquinn13/HostWords" "/users/jquinn13/InvertedIndex" "InvertedIndexMap.py" "InvertedIndexReduce.py"
elif [ "$1" = "OutLinks" ]; then
Hadoop "OutLinksMap.py,OutLinksReduce.py" "/users/jquinn13/Hosts" "/users/jquinn13/OutLinks" "OutLinksMap.py" "OutLinksReduce.py"
elif [ "$1" = "InLinks" ]; then
Hadoop "InLinksMap.py,InLinksReduce.py" "/users/jquinn13/Hosts" "/users/jquinn13/InLinks" "InLinksMap.py" "InLinksReduce.py"
elif [ "$1" = "NDegrees" ]; then
Hadoop "NDegreesMap.py,NDegreesReduce.py" "/users/jquinn13/Hosts" "/users/jquinn13/NDegrees" "NDegreesMap.py" "NDegreesReduce.py"
else
echo "Not an option"
exit 1
fi
exit 0