forked from sgringwe/hadoop-presentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
197 lines (178 loc) · 6.9 KB
/
build.xml
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
<project name="hadoop-presentation" default="deploy" basedir=".">
<target name="init">
<property environment="env" />
<property name="sourceDir" value="src" />
<property name="dataDir" value="data" />
<property name="outputDir" value="classes" />
<property name="hadoopRootFolder" value="/user/sringwelski" />
<property name="hadoopCoreJarName" value="hadoop-core-0.20.2-cdh3u3.jar" />
</target>
<target name="prepare" depends="wordcount-clean">
<mkdir dir="${outputDir}" />
</target>
<!-- Wordcount program targetrs -->
<target name="wordcount-clean" depends="init">
<delete file="wordcount.jar" />
<delete dir="${outputDir}" />
</target>
<target name="wordcount-compile" depends="prepare">
<javac srcdir="${sourceDir}" destdir="${outputDir}" classpath="${env.HADOOP_HOME}/${hadoopCoreJarName}" />
<jar destfile="wordcount.jar" basedir="${outputDir}" />
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="" />
</exec>
</target>
<target name="wordcount-upload-input" depends="init">
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-rmr"/>
<arg value="${hadoopRootFolder}/wordcount/input"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-mkdir"/>
<arg value="${hadoopRootFolder}/wordcount/input"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-copyFromLocal"/>
<arg value="${dataDir}/file01"/>
<arg value="${hadoopRootFolder}/wordcount/input"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-copyFromLocal"/>
<arg value="${dataDir}/file02"/>
<arg value="${hadoopRootFolder}/wordcount/input"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-ls"/>
<arg value="${hadoopRootFolder}/wordcount/input"/>
</exec>
</target>
<target name="wordcount-run" depends="init">
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-rmr"/>
<arg value="${hadoopRootFolder}/wordcount/output"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="jar"/>
<arg value="wordcount.jar"/>
<arg value="com.sgringwe.wordcount.WordCountJob"/>
<arg value="${hadoopRootFolder}/wordcount/input"/>
<arg value="${hadoopRootFolder}/wordcount/output"/>
</exec>
</target>
<target name="wordcount-output" depends="init">
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-cat"/>
<arg value="${hadoopRootFolder}/wordcount/output/part-00000"/>
</exec>
</target>
<target name="wordcount" depends="wordcount-clean,wordcount-compile,wordcount-upload-input,wordcount-run,wordcount-output"/>
<!-- Wordlength program targetrs -->
<target name="wordlength-clean" depends="init">
<delete file="wordlength.jar" />
<delete dir="${outputDir}" />
</target>
<target name="wordlength-compile" depends="prepare">
<javac srcdir="${sourceDir}" destdir="${outputDir}" classpath="${env.HADOOP_HOME}/${hadoopCoreJarName}" />
<jar destfile="wordlength.jar" basedir="${outputDir}" />
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="" />
</exec>
</target>
<target name="wordlength-upload-input" depends="init">
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-rmr"/>
<arg value="${hadoopRootFolder}/wordlength/input"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-mkdir"/>
<arg value="${hadoopRootFolder}/wordlength/input"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-copyFromLocal"/>
<arg value="${dataDir}/file01"/>
<arg value="${hadoopRootFolder}/wordlength/input"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-copyFromLocal"/>
<arg value="${dataDir}/file02"/>
<arg value="${hadoopRootFolder}/wordlength/input"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-ls"/>
<arg value="${hadoopRootFolder}/wordlength/input"/>
</exec>
</target>
<target name="wordlength-run" depends="init">
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-rmr"/>
<arg value="${hadoopRootFolder}/wordlength/output"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="jar"/>
<arg value="wordlength.jar"/>
<arg value="com.sgringwe.wordlength.WordLengthJob"/>
<arg value="${hadoopRootFolder}/wordlength/input"/>
<arg value="${hadoopRootFolder}/wordlength/output"/>
</exec>
</target>
<target name="wordlength-output" depends="init">
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-cat"/>
<arg value="${hadoopRootFolder}/wordlength/output/part-00000"/>
</exec>
</target>
<target name="wordlength" depends="wordlength-clean,wordlength-compile,wordlength-upload-input,wordlength-run,wordlength-output"/>
<!-- ustrades program targetrs -->
<target name="ustrades-clean" depends="init">
<delete file="ustrades.jar" />
<delete dir="${outputDir}" />
</target>
<target name="ustrades-compile" depends="prepare">
<javac srcdir="${sourceDir}" destdir="${outputDir}" classpath="${env.HADOOP_HOME}/${hadoopCoreJarName}" />
<jar destfile="ustrades.jar" basedir="${outputDir}" />
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="" />
</exec>
</target>
<target name="ustrades-upload-input" depends="init">
<!-- 166mb file. it stays there -->
</target>
<target name="ustrades-run" depends="init">
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-rmr"/>
<arg value="${hadoopRootFolder}/ustrades/output"/>
</exec>
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="jar"/>
<arg value="ustrades.jar"/>
<arg value="com.sgringwe.ustrades.USTradesJob"/>
<arg value="${hadoopRootFolder}/ustrades/input"/>
<arg value="${hadoopRootFolder}/ustrades/output"/>
</exec>
</target>
<target name="ustrades-output" depends="init">
<exec executable="${env.HADOOP_HOME}/bin/hadoop">
<arg value="dfs"/>
<arg value="-cat"/>
<arg value="${hadoopRootFolder}/ustrades/output/part-00000"/>
</exec>
</target>
<target name="ustrades" depends="ustrades-clean,ustrades-compile,ustrades-upload-input,ustrades-run,ustrades-output"/>
<!-- Combined calls -->
<target name="clean" depends="wordcount-clean,wordlength-clean,ustrades-clean"/>
</project>