@Override public void routeDataMovementEventToDestination(DataMovementEvent event, int sourceTaskIndex, int sourceOutputIndex, Map<Integer, List<Integer>> mapDestTaskIndices) { if (conf.getRoutingTable().get(sourceOutputIndex).size() == 0) { // No task for given input, return empty list with -1 as index mapDestTaskIndices.put(-1, new ArrayList<>()); return; } // Normal case. List<Integer> outputIndices = Collections.singletonList(sourceTaskIndex); for (Integer destIndex : conf.getRoutingTable().get(sourceOutputIndex)) { mapDestTaskIndices.put(destIndex, outputIndices); } }
@Override public void routeDataMovementEventToDestination(DataMovementEvent event, int sourceTaskIndex, int sourceOutputIndex, Map<Integer, List<Integer>> mapDestTaskIndices) { List<Integer> outputIndices = Collections.singletonList(sourceTaskIndex); for (Integer destIndex : conf.getRoutingTable().get(sourceOutputIndex)) { mapDestTaskIndices.put(destIndex, outputIndices); } }
@Override public void initialize() { ByteBuffer payload = context.getUserPayload().getPayload(); LOG.info("Initializing the edge, payload: " + payload); if (payload == null) { throw new RuntimeException("Invalid payload"); } // De-serialization code DataInputByteBuffer dibb = new DataInputByteBuffer(); dibb.reset(payload); conf = new CustomEdgeConfiguration(); try { conf.readFields(dibb); } catch (IOException e) { throw new RuntimeException(e); } LOG.info("Routing table: " + conf.getRoutingTable() + " num Buckets: " + conf.getNumBuckets()); }
@Override public void initialize() { ByteBuffer payload = context.getUserPayload().getPayload(); LOG.info("Initializing the edge, payload: " + payload); if (payload == null) { throw new RuntimeException("Invalid payload"); } // De-serialization code DataInputByteBuffer dibb = new DataInputByteBuffer(); dibb.reset(payload); conf = new CustomEdgeConfiguration(); try { conf.readFields(dibb); } catch (IOException e) { throw new RuntimeException(e); } LOG.info("Routing table: " + conf.getRoutingTable() + " num Buckets: " + conf.getNumBuckets()); }
@Override public void routeDataMovementEventToDestination(DataMovementEvent event, int sourceTaskIndex, int sourceOutputIndex, Map<Integer, List<Integer>> mapDestTaskIndices) { List<Integer> outputIndices = Collections.singletonList(sourceTaskIndex); for (Integer destIndex : conf.getRoutingTable().get(sourceOutputIndex)) { mapDestTaskIndices.put(destIndex, outputIndices); } }
@Override public void initialize() { ByteBuffer payload = context.getUserPayload().getPayload(); LOG.info("Initializing the edge, payload: " + payload); if (payload == null) { throw new RuntimeException("Invalid payload"); } // De-serialization code DataInputByteBuffer dibb = new DataInputByteBuffer(); dibb.reset(payload); conf = new CustomEdgeConfiguration(); try { conf.readFields(dibb); } catch (IOException e) { throw new RuntimeException(e); } LOG.info("Routing table: " + conf.getRoutingTable() + " num Buckets: " + conf.getNumBuckets()); }