Search in sources :

Example 21 with INodeManager

use of org.apache.hyracks.control.cc.cluster.INodeManager in project asterixdb by apache.

the class RegisterNodeWork method doRun.

@Override
protected void doRun() throws Exception {
    String id = reg.getNodeId();
    IIPCHandle ncIPCHandle = ccs.getClusterIPC().getHandle(reg.getNodeControllerAddress());
    CCNCFunctions.NodeRegistrationResult result;
    Map<IOption, Object> ncConfiguration = new HashMap<>();
    try {
        INodeController nodeController = new NodeControllerRemoteProxy(ncIPCHandle);
        NodeControllerState state = new NodeControllerState(nodeController, reg);
        INodeManager nodeManager = ccs.getNodeManager();
        nodeManager.addNode(id, state);
        IApplicationConfig cfg = state.getNCConfig().getConfigManager().getNodeEffectiveConfig(id);
        for (IOption option : cfg.getOptions()) {
            ncConfiguration.put(option, cfg.get(option));
        }
        LOGGER.log(Level.INFO, "Registered INodeController: id = " + id);
        NodeParameters params = new NodeParameters();
        params.setClusterControllerInfo(ccs.getClusterControllerInfo());
        params.setDistributedState(ccs.getContext().getDistributedState());
        params.setHeartbeatPeriod(ccs.getCCConfig().getHeartbeatPeriod());
        params.setProfileDumpPeriod(ccs.getCCConfig().getProfileDumpPeriod());
        result = new CCNCFunctions.NodeRegistrationResult(params, null);
    } catch (Exception e) {
        result = new CCNCFunctions.NodeRegistrationResult(null, e);
    }
    ncIPCHandle.send(-1, result, null);
    ccs.getContext().notifyNodeJoin(id, ncConfiguration);
}
Also used : IIPCHandle(org.apache.hyracks.ipc.api.IIPCHandle) INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) NodeControllerRemoteProxy(org.apache.hyracks.control.common.ipc.NodeControllerRemoteProxy) INodeController(org.apache.hyracks.control.common.base.INodeController) HashMap(java.util.HashMap) CCNCFunctions(org.apache.hyracks.control.common.ipc.CCNCFunctions) NodeParameters(org.apache.hyracks.control.common.controllers.NodeParameters) IOption(org.apache.hyracks.api.config.IOption) IApplicationConfig(org.apache.hyracks.api.config.IApplicationConfig) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState)

Aggregations

INodeManager (org.apache.hyracks.control.cc.cluster.INodeManager)21 NodeControllerState (org.apache.hyracks.control.cc.NodeControllerState)15 HyracksException (org.apache.hyracks.api.exceptions.HyracksException)6 HashMap (java.util.HashMap)4 JobId (org.apache.hyracks.api.job.JobId)4 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 DeploymentId (org.apache.hyracks.api.deployment.DeploymentId)3 ActivityClusterGraph (org.apache.hyracks.api.job.ActivityClusterGraph)3 INodeController (org.apache.hyracks.control.common.base.INodeController)3 NetworkAddress (org.apache.hyracks.api.comm.NetworkAddress)2 LValueConstraintExpression (org.apache.hyracks.api.constraints.expressions.LValueConstraintExpression)2 ActivityId (org.apache.hyracks.api.dataflow.ActivityId)2 ConnectorDescriptorId (org.apache.hyracks.api.dataflow.ConnectorDescriptorId)2 TaskAttemptId (org.apache.hyracks.api.dataflow.TaskAttemptId)2 TaskId (org.apache.hyracks.api.dataflow.TaskId)2 IConnectorPolicy (org.apache.hyracks.api.dataflow.connectors.IConnectorPolicy)2 ClusterControllerService (org.apache.hyracks.control.cc.ClusterControllerService)2