|
26 | 26 | import java.util.ArrayList; |
27 | 27 | import java.util.HashSet; |
28 | 28 | import java.util.List; |
| 29 | +import java.util.Map; |
29 | 30 | import java.util.Set; |
30 | 31 | import java.util.logging.Logger; |
31 | 32 |
|
| 33 | +import edu.iu.dsc.tws.api.comms.DataFlowOperation; |
32 | 34 | import edu.iu.dsc.tws.api.comms.LogicalPlan; |
33 | | -import edu.iu.dsc.tws.api.comms.Op; |
| 35 | +import edu.iu.dsc.tws.api.comms.ReduceFunction; |
34 | 36 | import edu.iu.dsc.tws.api.comms.messaging.types.MessageTypes; |
35 | 37 | import edu.iu.dsc.tws.api.config.Config; |
36 | 38 | import edu.iu.dsc.tws.api.resource.IPersistentVolume; |
|
39 | 41 | import edu.iu.dsc.tws.api.resource.IWorkerController; |
40 | 42 | import edu.iu.dsc.tws.api.resource.WorkerEnvironment; |
41 | 43 | import edu.iu.dsc.tws.comms.batch.BKeyedReduce; |
42 | | -import edu.iu.dsc.tws.comms.functions.reduction.ReduceOperationFunction; |
43 | 44 | import edu.iu.dsc.tws.comms.selectors.HashingSelector; |
44 | 45 | import edu.iu.dsc.tws.examples.Utils; |
45 | 46 |
|
@@ -83,7 +84,18 @@ public void execute(Config cfg, int workerID, |
83 | 84 | // create the communication |
84 | 85 | wordAggregator = new WordAggregator(); |
85 | 86 | keyGather = new BKeyedReduce(workerEnv.getCommunicator(), logicalPlan, sources, destinations, |
86 | | - new ReduceOperationFunction(Op.SUM, MessageTypes.INTEGER), |
| 87 | + new ReduceFunction() { |
| 88 | + @Override |
| 89 | + public void init(Config cfg, DataFlowOperation op, Map<Integer, |
| 90 | + List<Integer>> expectedIds) { |
| 91 | + |
| 92 | + } |
| 93 | + |
| 94 | + @Override |
| 95 | + public Object reduce(Object t1, Object t2) { |
| 96 | + return (Integer) t1 + (Integer) t2; |
| 97 | + } |
| 98 | + }, |
87 | 99 | wordAggregator, MessageTypes.OBJECT, MessageTypes.INTEGER, new HashingSelector()); |
88 | 100 | // assign the task ids to the workers, and run them using threads |
89 | 101 | scheduleTasks(); |
|
0 commit comments