public static Object deserialize(ByteBuffer buffer, int length) throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream(buffer.array(), buffer.position(), length); DataInputStream dis = new DataInputStream(bais); JobId jobId = JobId.create(dis); String nodeId = dis.readUTF(); TaskAttemptId taskId = TaskAttemptId.create(dis); TaskProfile statistics = TaskProfile.create(dis); return new NotifyTaskCompleteFunction(jobId, taskId, nodeId, statistics); }
case NOTIFY_TASK_COMPLETE: CCNCFunctions.NotifyTaskCompleteFunction ntcf = (CCNCFunctions.NotifyTaskCompleteFunction) fn; ccs.getWorkQueue().schedule(new TaskCompleteWork(ccs, ntcf.getJobId(), ntcf.getTaskId(), ntcf.getNodeId(), ntcf.getStatistics())); break; case NOTIFY_TASK_FAILURE:
private void serialize(OutputStream out, Object object, byte fid) throws Exception { switch (FunctionId.values()[fid]) { case REGISTER_PARTITION_PROVIDER: RegisterPartitionProviderFunction.serialize(out, object); return; case REGISTER_PARTITION_REQUEST: RegisterPartitionRequestFunction.serialize(out, object); return; case REPORT_PARTITION_AVAILABILITY: ReportPartitionAvailabilityFunction.serialize(out, object); return; case NODE_HEARTBEAT: NodeHeartbeatFunction.serialize(out, object); return; case START_TASKS: StartTasksFunction.serialize(out, object); return; case NOTIFY_TASK_COMPLETE: NotifyTaskCompleteFunction.serialize(out, object); return; case NOTIFY_JOBLET_CLEANUP: NotifyJobletCleanupFunction.serialize(out, object); return; case CLEANUP_JOBLET: CleanupJobletFunction.serialize(out, object); return; } JavaSerializationBasedPayloadSerializerDeserializer.serialize(out, object); }
private Object deserialize(byte fid, ByteBuffer buffer, int length) throws Exception { switch (FunctionId.values()[fid]) { case REGISTER_PARTITION_PROVIDER: return RegisterPartitionProviderFunction.deserialize(buffer, length); case REGISTER_PARTITION_REQUEST: return RegisterPartitionRequestFunction.deserialize(buffer, length); case REPORT_PARTITION_AVAILABILITY: return ReportPartitionAvailabilityFunction.deserialize(buffer, length); case NODE_HEARTBEAT: return NodeHeartbeatFunction.deserialize(buffer, length); case START_TASKS: return StartTasksFunction.deserialize(buffer, length); case NOTIFY_TASK_COMPLETE: return NotifyTaskCompleteFunction.deserialize(buffer, length); case NOTIFY_JOBLET_CLEANUP: return NotifyJobletCleanupFunction.deserialize(buffer, length); case CLEANUP_JOBLET: return CleanupJobletFunction.deserialize(buffer, length); } return javaSerde.deserializeObject(buffer, length); } }
@Override public void notifyTaskComplete(JobId jobId, TaskAttemptId taskId, String nodeId, TaskProfile statistics) throws Exception { NotifyTaskCompleteFunction fn = new NotifyTaskCompleteFunction(jobId, taskId, nodeId, statistics); ipcHandle.send(-1, fn, null); }