Search in sources :

Example 11 with NodeControllerState

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

the class NodeManager method getNodeControllerInfoMap.

@Override
public Map<String, NodeControllerInfo> getNodeControllerInfoMap() {
    Map<String, NodeControllerInfo> result = new LinkedHashMap<>();
    for (Map.Entry<String, NodeControllerState> e : nodeRegistry.entrySet()) {
        NodeControllerState ncState = e.getValue();
        result.put(e.getKey(), new NodeControllerInfo(e.getKey(), NodeStatus.ALIVE, ncState.getDataPort(), ncState.getDatasetPort(), ncState.getMessagingPort(), ncState.getCapacity().getCores()));
    }
    return result;
}
Also used : NodeControllerInfo(org.apache.hyracks.api.client.NodeControllerInfo) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Example 12 with NodeControllerState

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

the class NodeManager method removeNode.

@Override
public void removeNode(String nodeId) throws HyracksException {
    NodeControllerState ncState = nodeRegistry.remove(nodeId);
    removeNodeFromIpAddressMap(nodeId, ncState);
    // Updates the cluster capacity.
    resourceManager.update(nodeId, new NodeCapacity(0L, 0));
}
Also used : NodeCapacity(org.apache.hyracks.api.job.resource.NodeCapacity) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState)

Example 13 with NodeControllerState

use of org.apache.hyracks.control.cc.NodeControllerState 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 14 with NodeControllerState

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

the class AbstractHeartbeatWork method doRun.

@Override
public void doRun() {
    INodeManager nodeManager = ccs.getNodeManager();
    NodeControllerState state = nodeManager.getNodeControllerState(nodeId);
    if (state != null) {
        state.notifyHeartbeat(hbData);
    }
    runWork();
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState)

Example 15 with NodeControllerState

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

the class JobExecutor method startTasks.

private void startTasks(Map<String, List<TaskAttemptDescriptor>> taskAttemptMap) throws HyracksException {
    final DeploymentId deploymentId = jobRun.getDeploymentId();
    final JobId jobId = jobRun.getJobId();
    final ActivityClusterGraph acg = jobRun.getActivityClusterGraph();
    final Map<ConnectorDescriptorId, IConnectorPolicy> connectorPolicies = new HashMap<>(jobRun.getConnectorPolicyMap());
    INodeManager nodeManager = ccs.getNodeManager();
    try {
        byte[] acgBytes = predistributed ? null : JavaSerializationUtils.serialize(acg);
        for (Map.Entry<String, List<TaskAttemptDescriptor>> entry : taskAttemptMap.entrySet()) {
            String nodeId = entry.getKey();
            final List<TaskAttemptDescriptor> taskDescriptors = entry.getValue();
            final NodeControllerState node = nodeManager.getNodeControllerState(nodeId);
            if (node != null) {
                node.getActiveJobIds().add(jobRun.getJobId());
                boolean changed = jobRun.getParticipatingNodeIds().add(nodeId);
                if (LOGGER.isLoggable(Level.FINE)) {
                    LOGGER.fine("Starting: " + taskDescriptors + " at " + entry.getKey());
                }
                byte[] jagBytes = changed ? acgBytes : null;
                node.getNodeController().startTasks(deploymentId, jobId, jagBytes, taskDescriptors, connectorPolicies, jobRun.getFlags());
            }
        }
    } catch (Exception e) {
        throw new HyracksException(e);
    }
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) DeploymentId(org.apache.hyracks.api.deployment.DeploymentId) HashMap(java.util.HashMap) IConnectorPolicy(org.apache.hyracks.api.dataflow.connectors.IConnectorPolicy) ConnectorDescriptorId(org.apache.hyracks.api.dataflow.ConnectorDescriptorId) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) TaskAttemptDescriptor(org.apache.hyracks.control.common.job.TaskAttemptDescriptor) ActivityClusterGraph(org.apache.hyracks.api.job.ActivityClusterGraph) ArrayList(java.util.ArrayList) List(java.util.List) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState) HashMap(java.util.HashMap) Map(java.util.Map) JobId(org.apache.hyracks.api.job.JobId)

Aggregations

NodeControllerState (org.apache.hyracks.control.cc.NodeControllerState)23 INodeManager (org.apache.hyracks.control.cc.cluster.INodeManager)15 HashMap (java.util.HashMap)5 HyracksException (org.apache.hyracks.api.exceptions.HyracksException)5 HashSet (java.util.HashSet)4 Map (java.util.Map)4 JobId (org.apache.hyracks.api.job.JobId)4 DeploymentId (org.apache.hyracks.api.deployment.DeploymentId)3 NodeCapacity (org.apache.hyracks.api.job.resource.NodeCapacity)3 INodeController (org.apache.hyracks.control.common.base.INodeController)3 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 NetworkAddress (org.apache.hyracks.api.comm.NetworkAddress)2 ActivityClusterGraph (org.apache.hyracks.api.job.ActivityClusterGraph)2 IResourceManager (org.apache.hyracks.control.cc.scheduler.IResourceManager)2 ResourceManager (org.apache.hyracks.control.cc.scheduler.ResourceManager)2 NCConfig (org.apache.hyracks.control.common.controllers.NCConfig)2 DeploymentRun (org.apache.hyracks.control.common.deployment.DeploymentRun)2 Test (org.junit.Test)2