public static PartitionProfile create(DataInput dis) throws IOException { PartitionProfile partitionProfile = new PartitionProfile(); partitionProfile.readFields(dis); return partitionProfile; }
public void setPartitionSendProfile(PartitionProfile profile) { partitionSendProfile.put(profile.getPartitionId(), profile); }
for (PartitionProfile pp : partitionSendProfile.values()) { ObjectNode ppObj = om.createObjectNode(); PartitionId pid = pp.getPartitionId(); ObjectNode pidObj = om.createObjectNode(); pidObj.put("job-id", pid.getJobId().toString()); pidObj.put("receiver-index", pid.getReceiverIndex()); ppObj.set("partition-id", pidObj); ppObj.put("open-time", pp.getOpenTime()); ppObj.put("close-time", pp.getCloseTime()); MultiResolutionEventProfiler samples = pp.getSamples(); ppObj.put("offset", samples.getOffset()); int resolution = samples.getResolution();
@Override public void close() throws HyracksDataException { closeTime = System.currentTimeMillis(); try { ((Task) ctx).setPartitionSendProfile( new PartitionProfile(new PartitionId(ctx.getJobletContext().getJobId(), cd.getConnectorId(), senderIndex, receiverIndex), openTime, closeTime, mrep)); } finally { writer.close(); } }
@Override public void writeFields(DataOutput output) throws IOException { super.writeFields(output); taskAttemptId.writeFields(output); output.writeInt(partitionSendProfile.size()); for (Entry<PartitionId, PartitionProfile> entry : partitionSendProfile.entrySet()) { entry.getKey().writeFields(output); entry.getValue().writeFields(output); } statsCollector.writeFields(output); } }
@Override public void readFields(DataInput input) throws IOException { super.readFields(input); taskAttemptId = TaskAttemptId.create(input); int size = input.readInt(); partitionSendProfile = new HashMap<>(); for (int i = 0; i < size; i++) { PartitionId key = PartitionId.create(input); PartitionProfile value = PartitionProfile.create(input); partitionSendProfile.put(key, value); } statsCollector = StatsCollector.create(input); }