-
Notifications
You must be signed in to change notification settings - Fork 0
/
BatchRun_Pig.sh
279 lines (200 loc) · 9.02 KB
/
BatchRun_Pig.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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
############################################
# Remove all records from TIMECHECK folder #
############################################
rm -r -v /home/student/bdm/TIMECHECK
mkdir /home/student/bdm/TIMECHECK
#######################################################################
# Part 1: Load data from HDFS Storage, Define Schema, Preprocess Data #
#######################################################################
# Start time #
start_time_load=$(date +%s)
echo "Running 1_load_data.pig script"
# Run 1_load_data.pig script #
pig -f /home/student/bdm/pig/1_load_data.pig
# End time #
end_time_load=$(date +%s)
# Time taken #
duration_load_sec=$((end_time_load-start_time_load))
duration_load_min=$(((end_time_load-start_time_load)/60))
echo "[Duration] Time taken to run Part 1 Load, Define Schema, Preprocess Data : $duration_load_sec seconds or $duration_load_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
######################
# Part 2: Query Data #
######################
#-------------------------------#
# Run 2_query_data_1.pig script #
#-------------------------------#
# Start time #
start_time_query1=$(date +%s)
echo "Running 2_query_data_1.pig script"
pig -f /home/student/bdm/pig/2_query_data_1.pig
# End time #
end_time_query1=$(date +%s)
# Time taken #
duration_query1_sec=$((end_time_query1-start_time_query1))
duration_query1_min=$(((end_time_query1-start_time_query1)/60))
echo "[Duration] Time taken to run Part 2 Query Data (Top20 Listings in overall): $duration_query1_sec seconds or $duration_query1_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#-------------------------------#
# Run 2_query_data_2.pig script #
#-------------------------------#
# Start time #
start_time_query2=$(date +%s)
echo "Running 2_query_data_2.pig script"
pig -f /home/student/bdm/pig/2_query_data_2.pig
# End time #
end_time_query2=$(date +%s)
# Time taken #
duration_query2_sec=$((end_time_query2-start_time_query2))
duration_query2_min=$(((end_time_query2-start_time_query2)/60))
echo "[Duration] Time taken to run Part 2 Query Data (Top20 Listings in terms of Cleanliness): $duration_query2_sec seconds or $duration_query2_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#-------------------------------#
# Run 2_query_data_3.pig script #
#-------------------------------#
# Start time #
start_time_query3=$(date +%s)
echo "Running 2_query_data_3.pig script"
pig -f /home/student/bdm/pig/2_query_data_3.pig
# End time #
end_time_query3=$(date +%s)
# Time taken #
duration_query3_sec=$((end_time_query3-start_time_query3))
duration_query3_min=$(((end_time_query3-start_time_query3)/60))
echo "[Duration] Time taken to run Part 2 Query Data (Top20 Listings in terms of Accuracy): $duration_query3_sec seconds or $duration_query3_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#-------------------------------#
# Run 2_query_data_4.pig script #
#-------------------------------#
# Start time #
start_time_query4=$(date +%s)
echo "Running 2_query_data_4.pig script"
pig -f /home/student/bdm/pig/2_query_data_4.pig
# End time #
end_time_query4=$(date +%s)
# Time taken #
duration_query4_sec=$((end_time_query4-start_time_query4))
duration_query4_min=$(((end_time_query4-start_time_query4)/60))
echo "[Duration] Time taken to run Part 2 Query Data (Top20 Listings in terms of Check-in): $duration_query4_sec seconds or $duration_query4_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#-------------------------------#
# Run 2_query_data_5.pig script #
#-------------------------------#
# Start time #
start_time_query5=$(date +%s)
echo "Running 2_query_data_5.pig script"
pig -f /home/student/bdm/pig/2_query_data_5.pig
# End time #
end_time_query5=$(date +%s)
# Time taken #
duration_query5_sec=$((end_time_query5-start_time_query5))
duration_query5_min=$(((end_time_query5-start_time_query5)/60))
echo "[Duration] Time taken to run Part 2 Query Data (Top20 Listings in terms of Communication): $duration_query5_sec seconds or $duration_query5_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#-------------------------------#
# Run 2_query_data_6.pig script #
#-------------------------------#
# Start time #
start_time_query6=$(date +%s)
echo "Running 2_query_data_6.pig script"
pig -f /home/student/bdm/pig/2_query_data_6.pig
# End time #
end_time_query6=$(date +%s)
# Time taken #
duration_query6_sec=$((end_time_query6-start_time_query6))
duration_query6_min=$(((end_time_query6-start_time_query6)/60))
echo "[Duration] Time taken to run Part 2 Query Data (Top20 Listings in terms of Location): $duration_query6_sec seconds or $duration_query6_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#-------------------------------#
# Run 2_query_data_7.pig script #
#-------------------------------#
# Start time #
start_time_query7=$(date +%s)
echo "Running 2_query_data_7.pig script"
pig -f /home/student/bdm/pig/2_query_data_7.pig
# End time #
end_time_query7=$(date +%s)
# Time taken #
duration_query7_sec=$((end_time_query7-start_time_query7))
duration_query7_min=$(((end_time_query7-start_time_query7)/60))
echo "[Duration] Time taken to run Part 2 Query Data (Top20 Listings in terms of Value): $duration_query7_sec seconds or $duration_query7_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#########################
# Part 3: Analysis Data #
#########################
#----------------------------------#
# Run 3_analysis_data_1.pig script #
#----------------------------------#
# Start time #
start_time_ana1=$(date +%s)
echo "Running 3_analysis_data_1.pig script"
echo ""
pig -f /home/student/bdm/pig/3_analysis_data_1.pig
# End time #
end_time_ana1=$(date +%s)
# Time taken #
duration_ana1_sec=$((end_time_ana1-start_time_ana1))
duration_ana1_min=$(((end_time_ana1-start_time_ana1)/60))
echo "[Duration] Time taken to run Part 3: Analysis Data (Listing - Count by Room Type): $duration_ana1_sec seconds or $duration_ana1_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#----------------------------------#
# Run 3_analysis_data_2.pig script #
#----------------------------------#
# Start time #
start_time_ana2=$(date +%s)
echo "Running 3_analysis_data_2.pig script"
echo ""
pig -f /home/student/bdm/pig/3_analysis_data_2.pig
# End time #
end_time_ana2=$(date +%s)
# Time taken #
duration_ana2_sec=$((end_time_ana2-start_time_ana2))
duration_ana2_min=$(((end_time_ana2-start_time_ana2)/60))
echo "[Duration] Time taken to run Part 3: Analysis Data (Listing - Count by Property Type): $duration_ana2_sec seconds or $duration_ana2_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#----------------------------------#
# Run 3_analysis_data_3.pig script #
#----------------------------------#
# Start time #
start_time_ana3=$(date +%s)
echo "Running 3_analysis_data_3.pig script"
echo ""
pig -f /home/student/bdm/pig/3_analysis_data_3.pig
# End time #
end_time_ana3=$(date +%s)
# Time taken #
duration_ana3_sec=$((end_time_ana3-start_time_ana3))
duration_ana3_min=$(((end_time_ana3-start_time_ana3)/60))
echo "[Duration] Time taken to run Part 3: Analysis Data (Top 10 Property Type with Expensive Average Price): $duration_ana3_sec seconds or $duration_ana3_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#----------------------------------#
# Run 3_analysis_data_4.pig script #
#----------------------------------#
# Start time #
start_time_ana4=$(date +%s)
echo "Running 3_analysis_data_4.pig script"
echo ""
pig -f /home/student/bdm/pig/3_analysis_data_4.pig
# End time #
end_time_ana4=$(date +%s)
# Time taken #
duration_ana4_sec=$((end_time_ana4-start_time_ana4))
duration_ana4_min=$(((end_time_ana4-start_time_ana4)/60))
echo "[Duration] Time taken to run Part 3: Analysis Data (Top 10 Property Type with Cheapest Average Price): $duration_ana4_sec seconds or $duration_ana4_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#----------------------------------#
# Run 3_analysis_data_5.pig script #
#----------------------------------#
# Start time #
start_time_ana5=$(date +%s)
echo "Running 3_analysis_data_5.pig script"
echo ""
pig -f /home/student/bdm/pig/3_analysis_data_5.pig
# End time #
end_time_ana5=$(date +%s)
# Time taken #
duration_ana5_sec=$((end_time_ana5-start_time_ana5))
duration_ana5_min=$(((end_time_ana5-start_time_ana5)/60))
echo "[Duration] Time taken to run Part 3: Analysis Data (Number of reviews by year): $duration_ana5_sec seconds or $duration_ana5_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt
#----------------------------------#
# Run 3_analysis_data_6.pig script #
#----------------------------------#
# Start time #
start_time_ana6=$(date +%s)
echo "Running 3_analysis_data_6.pig script"
echo ""
pig -f /home/student/bdm/pig/3_analysis_data_6.pig
# End time #
end_time_ana6=$(date +%s)
# Time taken #
duration_ana6_sec=$((end_time_ana6-start_time_ana6))
duration_ana6_min=$(((end_time_ana6-start_time_ana6)/60))
echo "[Duration] Time taken to run Part 3: Analysis Data (Average Price by location): $duration_ana6_sec seconds or $duration_ana6_min minutes" >> /home/student/bdm/TIMECHECK/time_check_pig.txt