Search in sources :

Example 1 with INodeController

use of org.apache.hyracks.control.common.base.INodeController in project asterixdb by apache.

the class PartitionUtils method reportPartitionMatch.

public static void reportPartitionMatch(ClusterControllerService ccs, final PartitionId pid, Pair<PartitionDescriptor, PartitionRequest> match) throws Exception {
    PartitionDescriptor desc = match.getLeft();
    PartitionRequest req = match.getRight();
    INodeManager nodeManager = ccs.getNodeManager();
    NodeControllerState producerNCS = nodeManager.getNodeControllerState(desc.getNodeId());
    NodeControllerState requestorNCS = nodeManager.getNodeControllerState(req.getNodeId());
    final NetworkAddress dataport = producerNCS.getDataPort();
    final INodeController requestorNC = requestorNCS.getNodeController();
    requestorNC.reportPartitionAvailability(pid, dataport);
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) NetworkAddress(org.apache.hyracks.api.comm.NetworkAddress) INodeController(org.apache.hyracks.control.common.base.INodeController) PartitionRequest(org.apache.hyracks.control.common.job.PartitionRequest) PartitionDescriptor(org.apache.hyracks.control.common.job.PartitionDescriptor) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState)

Example 2 with INodeController

use of org.apache.hyracks.control.common.base.INodeController in project asterixdb by apache.

the class JobManagerTest method mockNodeManager.

private INodeManager mockNodeManager() {
    INodeManager nodeManager = mock(NodeManager.class);
    NodeControllerState ncState = mock(NodeControllerState.class);
    INodeController nodeController = mock(INodeController.class);
    when(nodeManager.getNodeControllerState(any())).thenReturn(ncState);
    when(ncState.getNodeController()).thenReturn(nodeController);
    return nodeManager;
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) INodeController(org.apache.hyracks.control.common.base.INodeController) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState)

Example 3 with INodeController

use of org.apache.hyracks.control.common.base.INodeController 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

NodeControllerState (org.apache.hyracks.control.cc.NodeControllerState)3 INodeManager (org.apache.hyracks.control.cc.cluster.INodeManager)3 INodeController (org.apache.hyracks.control.common.base.INodeController)3 HashMap (java.util.HashMap)1 NetworkAddress (org.apache.hyracks.api.comm.NetworkAddress)1 IApplicationConfig (org.apache.hyracks.api.config.IApplicationConfig)1 IOption (org.apache.hyracks.api.config.IOption)1 NodeParameters (org.apache.hyracks.control.common.controllers.NodeParameters)1 CCNCFunctions (org.apache.hyracks.control.common.ipc.CCNCFunctions)1 NodeControllerRemoteProxy (org.apache.hyracks.control.common.ipc.NodeControllerRemoteProxy)1 PartitionDescriptor (org.apache.hyracks.control.common.job.PartitionDescriptor)1 PartitionRequest (org.apache.hyracks.control.common.job.PartitionRequest)1 IIPCHandle (org.apache.hyracks.ipc.api.IIPCHandle)1