Search in sources :

Example 1 with Function

use of org.apache.hyracks.control.common.ipc.CCNCFunctions.Function in project asterixdb by apache.

the class ClusterControllerIPCI method deliverIncomingMessage.

@Override
public void deliverIncomingMessage(final IIPCHandle handle, long mid, long rmid, Object payload, Exception exception) {
    CCNCFunctions.Function fn = (Function) payload;
    switch(fn.getFunctionId()) {
        case REGISTER_NODE:
            CCNCFunctions.RegisterNodeFunction rnf = (CCNCFunctions.RegisterNodeFunction) fn;
            ccs.getWorkQueue().schedule(new RegisterNodeWork(ccs, rnf.getNodeRegistration()));
            break;
        case UNREGISTER_NODE:
            CCNCFunctions.UnregisterNodeFunction unf = (CCNCFunctions.UnregisterNodeFunction) fn;
            ccs.getWorkQueue().schedule(new UnregisterNodeWork(ccs.getNodeManager(), unf.getNodeId()));
            break;
        case NODE_HEARTBEAT:
            CCNCFunctions.NodeHeartbeatFunction nhf = (CCNCFunctions.NodeHeartbeatFunction) fn;
            ccs.getWorkQueue().schedule(new NodeHeartbeatWork(ccs, nhf.getNodeId(), nhf.getHeartbeatData()));
            break;
        case NOTIFY_JOBLET_CLEANUP:
            CCNCFunctions.NotifyJobletCleanupFunction njcf = (CCNCFunctions.NotifyJobletCleanupFunction) fn;
            ccs.getWorkQueue().schedule(new JobletCleanupNotificationWork(ccs, njcf.getJobId(), njcf.getNodeId()));
            break;
        case NOTIFY_DEPLOY_BINARY:
            CCNCFunctions.NotifyDeployBinaryFunction ndbf = (CCNCFunctions.NotifyDeployBinaryFunction) fn;
            ccs.getWorkQueue().schedule(new NotifyDeployBinaryWork(ccs, ndbf.getDeploymentId(), ndbf.getNodeId(), ndbf.getDeploymentStatus()));
            break;
        case REPORT_PROFILE:
            CCNCFunctions.ReportProfileFunction rpf = (CCNCFunctions.ReportProfileFunction) fn;
            ccs.getWorkQueue().schedule(new ReportProfilesWork(ccs.getJobManager(), rpf.getProfiles()));
            break;
        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:
            CCNCFunctions.NotifyTaskFailureFunction ntff = (CCNCFunctions.NotifyTaskFailureFunction) fn;
            ccs.getWorkQueue().schedule(new TaskFailureWork(ccs, ntff.getJobId(), ntff.getTaskId(), ntff.getNodeId(), ntff.getExceptions()));
            break;
        case DISTRIBUTED_JOB_FAILURE:
            CCNCFunctions.ReportDistributedJobFailureFunction rdjf = (CCNCFunctions.ReportDistributedJobFailureFunction) fn;
            ccs.getWorkQueue().schedule(new DistributedJobFailureWork(rdjf.getJobId(), rdjf.getNodeId()));
            break;
        case REGISTER_PARTITION_PROVIDER:
            CCNCFunctions.RegisterPartitionProviderFunction rppf = (CCNCFunctions.RegisterPartitionProviderFunction) fn;
            ccs.getWorkQueue().schedule(new RegisterPartitionAvailibilityWork(ccs, rppf.getPartitionDescriptor()));
            break;
        case REGISTER_PARTITION_REQUEST:
            CCNCFunctions.RegisterPartitionRequestFunction rprf = (CCNCFunctions.RegisterPartitionRequestFunction) fn;
            ccs.getWorkQueue().schedule(new RegisterPartitionRequestWork(ccs, rprf.getPartitionRequest()));
            break;
        case REGISTER_RESULT_PARTITION_LOCATION:
            CCNCFunctions.RegisterResultPartitionLocationFunction rrplf = (CCNCFunctions.RegisterResultPartitionLocationFunction) fn;
            ccs.getWorkQueue().schedule(new RegisterResultPartitionLocationWork(ccs, rrplf.getJobId(), rrplf.getResultSetId(), rrplf.getOrderedResult(), rrplf.getEmptyResult(), rrplf.getPartition(), rrplf.getNPartitions(), rrplf.getNetworkAddress()));
            break;
        case REPORT_RESULT_PARTITION_WRITE_COMPLETION:
            CCNCFunctions.ReportResultPartitionWriteCompletionFunction rrpwc = (CCNCFunctions.ReportResultPartitionWriteCompletionFunction) fn;
            ccs.getWorkQueue().schedule(new ReportResultPartitionWriteCompletionWork(ccs, rrpwc.getJobId(), rrpwc.getResultSetId(), rrpwc.getPartition()));
            break;
        case REPORT_RESULT_PARTITION_FAILURE:
            CCNCFunctions.ReportResultPartitionFailureFunction rrpf = (CCNCFunctions.ReportResultPartitionFailureFunction) fn;
            ccs.getWorkQueue().schedule(new ReportResultPartitionFailureWork(ccs, rrpf.getJobId(), rrpf.getResultSetId(), rrpf.getPartition()));
            break;
        case SEND_APPLICATION_MESSAGE:
            CCNCFunctions.SendApplicationMessageFunction rsf = (CCNCFunctions.SendApplicationMessageFunction) fn;
            ccs.getWorkQueue().schedule(new ApplicationMessageWork(ccs, rsf.getMessage(), rsf.getDeploymentId(), rsf.getNodeId()));
            break;
        case GET_NODE_CONTROLLERS_INFO:
            ccs.getWorkQueue().schedule(new GetNodeControllersInfoWork(ccs.getNodeManager(), new IResultCallback<Map<String, NodeControllerInfo>>() {

                @Override
                public void setValue(Map<String, NodeControllerInfo> result) {
                    new IPCResponder<CCNCFunctions.GetNodeControllersInfoResponseFunction>(handle, -1).setValue(new CCNCFunctions.GetNodeControllersInfoResponseFunction(result));
                }

                @Override
                public void setException(Exception e) {
                }
            }));
            break;
        case STATE_DUMP_RESPONSE:
            CCNCFunctions.StateDumpResponseFunction dsrf = (StateDumpResponseFunction) fn;
            ccs.getWorkQueue().schedule(new NotifyStateDumpResponse(ccs, dsrf.getNodeId(), dsrf.getStateDumpId(), dsrf.getState()));
            break;
        case SHUTDOWN_RESPONSE:
            CCNCFunctions.ShutdownResponseFunction sdrf = (ShutdownResponseFunction) fn;
            ccs.getWorkQueue().schedule(new NotifyShutdownWork(ccs, sdrf.getNodeId()));
            break;
        case THREAD_DUMP_RESPONSE:
            CCNCFunctions.ThreadDumpResponseFunction tdrf = (CCNCFunctions.ThreadDumpResponseFunction) fn;
            ccs.getWorkQueue().schedule(new NotifyThreadDumpResponse(ccs, tdrf.getRequestId(), tdrf.getThreadDumpJSON()));
            break;
        default:
            LOGGER.warning("Unknown function: " + fn.getFunctionId());
    }
}
Also used : NotifyStateDumpResponse(org.apache.hyracks.control.cc.work.NotifyStateDumpResponse) RegisterPartitionAvailibilityWork(org.apache.hyracks.control.cc.work.RegisterPartitionAvailibilityWork) NodeControllerInfo(org.apache.hyracks.api.client.NodeControllerInfo) Function(org.apache.hyracks.control.common.ipc.CCNCFunctions.Function) IResultCallback(org.apache.hyracks.control.common.work.IResultCallback) NotifyThreadDumpResponse(org.apache.hyracks.control.cc.work.NotifyThreadDumpResponse) ApplicationMessageWork(org.apache.hyracks.control.cc.work.ApplicationMessageWork) ReportProfilesWork(org.apache.hyracks.control.cc.work.ReportProfilesWork) ShutdownResponseFunction(org.apache.hyracks.control.common.ipc.CCNCFunctions.ShutdownResponseFunction) ReportResultPartitionWriteCompletionWork(org.apache.hyracks.control.cc.work.ReportResultPartitionWriteCompletionWork) NotifyShutdownWork(org.apache.hyracks.control.cc.work.NotifyShutdownWork) NodeHeartbeatWork(org.apache.hyracks.control.cc.work.NodeHeartbeatWork) UnregisterNodeWork(org.apache.hyracks.control.cc.work.UnregisterNodeWork) GetNodeControllersInfoWork(org.apache.hyracks.control.cc.work.GetNodeControllersInfoWork) Map(java.util.Map) ReportResultPartitionFailureWork(org.apache.hyracks.control.cc.work.ReportResultPartitionFailureWork) CCNCFunctions(org.apache.hyracks.control.common.ipc.CCNCFunctions) NotifyDeployBinaryWork(org.apache.hyracks.control.cc.work.NotifyDeployBinaryWork) StateDumpResponseFunction(org.apache.hyracks.control.common.ipc.CCNCFunctions.StateDumpResponseFunction) RegisterResultPartitionLocationWork(org.apache.hyracks.control.cc.work.RegisterResultPartitionLocationWork) ShutdownResponseFunction(org.apache.hyracks.control.common.ipc.CCNCFunctions.ShutdownResponseFunction) Function(org.apache.hyracks.control.common.ipc.CCNCFunctions.Function) StateDumpResponseFunction(org.apache.hyracks.control.common.ipc.CCNCFunctions.StateDumpResponseFunction) TaskFailureWork(org.apache.hyracks.control.cc.work.TaskFailureWork) ShutdownResponseFunction(org.apache.hyracks.control.common.ipc.CCNCFunctions.ShutdownResponseFunction) RegisterNodeWork(org.apache.hyracks.control.cc.work.RegisterNodeWork) DistributedJobFailureWork(org.apache.hyracks.control.cc.work.DistributedJobFailureWork) JobletCleanupNotificationWork(org.apache.hyracks.control.cc.work.JobletCleanupNotificationWork) TaskCompleteWork(org.apache.hyracks.control.cc.work.TaskCompleteWork) StateDumpResponseFunction(org.apache.hyracks.control.common.ipc.CCNCFunctions.StateDumpResponseFunction) RegisterPartitionRequestWork(org.apache.hyracks.control.cc.work.RegisterPartitionRequestWork)

Aggregations

Map (java.util.Map)1 NodeControllerInfo (org.apache.hyracks.api.client.NodeControllerInfo)1 ApplicationMessageWork (org.apache.hyracks.control.cc.work.ApplicationMessageWork)1 DistributedJobFailureWork (org.apache.hyracks.control.cc.work.DistributedJobFailureWork)1 GetNodeControllersInfoWork (org.apache.hyracks.control.cc.work.GetNodeControllersInfoWork)1 JobletCleanupNotificationWork (org.apache.hyracks.control.cc.work.JobletCleanupNotificationWork)1 NodeHeartbeatWork (org.apache.hyracks.control.cc.work.NodeHeartbeatWork)1 NotifyDeployBinaryWork (org.apache.hyracks.control.cc.work.NotifyDeployBinaryWork)1 NotifyShutdownWork (org.apache.hyracks.control.cc.work.NotifyShutdownWork)1 NotifyStateDumpResponse (org.apache.hyracks.control.cc.work.NotifyStateDumpResponse)1 NotifyThreadDumpResponse (org.apache.hyracks.control.cc.work.NotifyThreadDumpResponse)1 RegisterNodeWork (org.apache.hyracks.control.cc.work.RegisterNodeWork)1 RegisterPartitionAvailibilityWork (org.apache.hyracks.control.cc.work.RegisterPartitionAvailibilityWork)1 RegisterPartitionRequestWork (org.apache.hyracks.control.cc.work.RegisterPartitionRequestWork)1 RegisterResultPartitionLocationWork (org.apache.hyracks.control.cc.work.RegisterResultPartitionLocationWork)1 ReportProfilesWork (org.apache.hyracks.control.cc.work.ReportProfilesWork)1 ReportResultPartitionFailureWork (org.apache.hyracks.control.cc.work.ReportResultPartitionFailureWork)1 ReportResultPartitionWriteCompletionWork (org.apache.hyracks.control.cc.work.ReportResultPartitionWriteCompletionWork)1 TaskCompleteWork (org.apache.hyracks.control.cc.work.TaskCompleteWork)1 TaskFailureWork (org.apache.hyracks.control.cc.work.TaskFailureWork)1