This project has retired. For details please refer to its
Attic page.
JythonJob xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.giraph.jython;
19
20 import com.google.common.base.MoreObjects;
21 import org.apache.giraph.combiner.MessageCombiner;
22
23 import com.google.common.collect.Lists;
24 import com.google.common.collect.Maps;
25
26 import java.util.List;
27 import java.util.Map;
28
29
30
31
32
33
34
35
36 public class JythonJob {
37
38
39
40 public static class InputBase {
41
42 private String table;
43
44 private String partition_filter;
45
46 public String getPartition_filter() {
47 return partition_filter;
48 }
49
50 public void setPartition_filter(String partition_filter) {
51 this.partition_filter = partition_filter;
52 }
53
54 public String getTable() {
55 return table;
56 }
57
58 public void setTable(String table) {
59 this.table = table;
60 }
61
62 @Override public String toString() {
63 return MoreObjects.toStringHelper(this)
64 .add("table", table)
65 .add("partition_filter", partition_filter)
66 .toString();
67 }
68 }
69
70
71
72
73 public static class VertexInput extends InputBase {
74
75 private String id_column;
76
77 private String value_column;
78
79 public String getId_column() {
80 return id_column;
81 }
82
83 public void setId_column(String id_column) {
84 this.id_column = id_column;
85 }
86
87 public String getValue_column() {
88 return value_column;
89 }
90
91 public void setValue_column(String value_column) {
92 this.value_column = value_column;
93 }
94
95 @Override public String toString() {
96 return MoreObjects.toStringHelper(this)
97 .add("table", getTable())
98 .add("partition_filter", getPartition_filter())
99 .add("id_column", id_column)
100 .add("value_column", value_column)
101 .toString();
102 }
103 }
104
105
106
107
108 public static class EdgeInput extends InputBase {
109
110 private String source_id_column;
111
112 private String target_id_column;
113
114 private String value_column;
115
116 public String getValue_column() {
117 return value_column;
118 }
119
120 public void setValue_column(String value_column) {
121 this.value_column = value_column;
122 }
123
124 public String getSource_id_column() {
125 return source_id_column;
126 }
127
128 public void setSource_id_column(String source_id_column) {
129 this.source_id_column = source_id_column;
130 }
131
132 public String getTarget_id_column() {
133 return target_id_column;
134 }
135
136 public void setTarget_id_column(String target_id_column) {
137 this.target_id_column = target_id_column;
138 }
139
140 @Override public String toString() {
141 return MoreObjects.toStringHelper(this)
142 .add("table", getTable())
143 .add("partition_filter", getPartition_filter())
144 .add("source_id_column", source_id_column)
145 .add("target_id_column", target_id_column)
146 .add("edge_value_column", value_column)
147 .toString();
148 }
149 }
150
151
152
153
154 public static class VertexOutput {
155
156 private String table;
157
158 private final Map<String, String> partition = Maps.newHashMap();
159
160 private String id_column;
161
162 private String value_column;
163
164 public String getId_column() {
165 return id_column;
166 }
167
168 public void setId_column(String id_column) {
169 this.id_column = id_column;
170 }
171
172 public Map<String, String> getPartition() {
173 return partition;
174 }
175
176 public String getTable() {
177 return table;
178 }
179
180 public void setTable(String table) {
181 this.table = table;
182 }
183
184 public String getValue_column() {
185 return value_column;
186 }
187
188 public void setValue_column(String value_column) {
189 this.value_column = value_column;
190 }
191
192 @Override public String toString() {
193 return MoreObjects.toStringHelper(this)
194 .add("table", table)
195 .add("partition", partition)
196 .add("id_column", id_column)
197 .add("value_column", value_column)
198 .toString();
199 }
200 }
201
202
203
204
205 public static class TypeHolder {
206
207
208
209
210
211
212
213
214
215 private Object type;
216
217 public Object getType() {
218 return type;
219 }
220
221 public void setType(Object type) {
222 this.type = type;
223 }
224 }
225
226
227
228
229 public static class TypeWithHive extends TypeHolder {
230
231 private Object hive_reader;
232
233 private Object hive_writer;
234
235 private Object hive_io;
236
237 public Object getHive_io() {
238 return hive_io;
239 }
240
241 public void setHive_io(Object hive_io) {
242 this.hive_io = hive_io;
243 }
244
245 public Object getHive_reader() {
246 return hive_reader;
247 }
248
249 public void setHive_reader(Object hive_reader) {
250 this.hive_reader = hive_reader;
251 }
252
253 public Object getHive_writer() {
254 return hive_writer;
255 }
256
257 public void setHive_writer(Object hive_writer) {
258 this.hive_writer = hive_writer;
259 }
260 }
261
262
263 private String name;
264
265 private String hive_database = "digraph";
266
267 private int workers;
268
269 private String pool;
270
271 private final TypeWithHive vertex_id = new TypeWithHive();
272
273 private final TypeWithHive vertex_value = new TypeWithHive();
274
275 private final TypeWithHive edge_value = new TypeWithHive();
276
277 private final TypeHolder incoming_message_value = new TypeHolder();
278
279 private final TypeHolder outgoing_message_value = new TypeHolder();
280
281 private final TypeHolder message_value = new TypeHolder();
282
283 private String computation_name;
284
285 private Class<? extends MessageCombiner> messageCombiner;
286
287 private final List<String> java_options = Lists.newArrayList();
288
289 private final Map<String, Object> giraph_options = Maps.newHashMap();
290
291 private final List<VertexInput> vertex_inputs = Lists.newArrayList();
292
293 private final List<EdgeInput> edge_inputs = Lists.newArrayList();
294
295 private final VertexOutput vertex_output = new VertexOutput();
296
297
298
299 private String user;
300
301
302
303
304 public JythonJob() {
305 user = System.getProperty("user.name");
306 workers = 5;
307 }
308
309 public String getUser() {
310 return user;
311 }
312
313 public TypeWithHive getVertex_value() {
314 return vertex_value;
315 }
316
317 public TypeWithHive getVertex_id() {
318 return vertex_id;
319 }
320
321 public TypeWithHive getEdge_value() {
322 return edge_value;
323 }
324
325 public TypeHolder getIncoming_message_value() {
326 return incoming_message_value;
327 }
328
329 public TypeHolder getOutgoing_message_value() {
330 return outgoing_message_value;
331 }
332
333 public TypeHolder getMessage_value() {
334 return message_value;
335 }
336
337 public List<String> getJava_options() {
338 return java_options;
339 }
340
341 public Map<String, Object> getGiraph_options() {
342 return giraph_options;
343 }
344
345 public Class<? extends MessageCombiner> getMessageCombiner() {
346 return messageCombiner;
347 }
348
349 public void setMessageCombiner(
350 Class<? extends MessageCombiner> messageCombiner) {
351 this.messageCombiner = messageCombiner;
352 }
353
354 public String getComputation_name() {
355 return computation_name;
356 }
357
358 public void setComputation_name(String computation_name) {
359 this.computation_name = computation_name;
360 }
361
362 public String getHive_database() {
363 return hive_database;
364 }
365
366 public void setHive_database(String hive_database) {
367 this.hive_database = hive_database;
368 }
369
370 public List<EdgeInput> getEdge_inputs() {
371 return edge_inputs;
372 }
373
374 public String getName() {
375 return name;
376 }
377
378 public void setName(String name) {
379 this.name = name;
380 }
381
382 public String getPool() {
383 return pool;
384 }
385
386 public void setPool(String pool) {
387 this.pool = pool;
388 }
389
390 public List<VertexInput> getVertex_inputs() {
391 return vertex_inputs;
392 }
393
394 public VertexOutput getVertex_output() {
395 return vertex_output;
396 }
397
398 public int getWorkers() {
399 return workers;
400 }
401
402 public void setWorkers(int workers) {
403 this.workers = workers;
404 }
405 }
406
407
408
409