Search in sources :

Example 1 with INodeManager

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

the class CCMessageBroker method sendApplicationMessageToNC.

@Override
public void sendApplicationMessageToNC(INcAddressedMessage msg, String nodeId) throws Exception {
    INodeManager nodeManager = ccs.getNodeManager();
    NodeControllerState state = nodeManager.getNodeControllerState(nodeId);
    state.getNodeController().sendApplicationMessageToNC(JavaSerializationUtils.serialize(msg), null, nodeId);
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState)

Example 2 with INodeManager

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

the class RuntimeUtils method getForcedNodeControllerMap.

public static Map<InetAddress, Set<String>> getForcedNodeControllerMap(ICcApplicationContext appCtx) {
    ClusterControllerService ccs = (ClusterControllerService) appCtx.getServiceContext().getControllerService();
    INodeManager nodeManager = ccs.getNodeManager();
    return nodeManager.getIpAddressNodeNameMap();
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) ClusterControllerService(org.apache.hyracks.control.cc.ClusterControllerService)

Example 3 with INodeManager

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

the class JobletCleanupNotificationWork method runWork.

@Override
public void runWork() {
    IJobManager jobManager = ccs.getJobManager();
    final JobRun run = jobManager.get(jobId);
    Set<String> cleanupPendingNodes = run.getCleanupPendingNodeIds();
    if (!cleanupPendingNodes.remove(nodeId)) {
        if (LOGGER.isLoggable(Level.WARNING)) {
            LOGGER.warning(nodeId + " not in pending cleanup nodes set: " + cleanupPendingNodes + " for Job: " + jobId);
        }
        return;
    }
    INodeManager nodeManager = ccs.getNodeManager();
    NodeControllerState ncs = nodeManager.getNodeControllerState(nodeId);
    if (ncs != null) {
        ncs.getActiveJobIds().remove(jobId);
    }
    if (cleanupPendingNodes.isEmpty()) {
        try {
            jobManager.finalComplete(run);
        } catch (HyracksException e) {
            // Fail the job with the caught exception during final completion.
            run.getExceptions().add(e);
            run.setStatus(JobStatus.FAILURE, run.getExceptions());
        }
    }
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) IJobManager(org.apache.hyracks.control.cc.job.IJobManager) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState) JobRun(org.apache.hyracks.control.cc.job.JobRun)

Example 4 with INodeManager

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

the class RemoveDeadNodesWork method run.

@Override
public void run() {
    try {
        INodeManager nodeManager = ccs.getNodeManager();
        Pair<Collection<String>, Collection<JobId>> result = nodeManager.removeDeadNodes();
        Collection<String> deadNodes = result.getLeft();
        Collection<JobId> affectedJobIds = result.getRight();
        int size = affectedJobIds.size();
        if (size > 0) {
            if (LOGGER.isLoggable(Level.INFO)) {
                LOGGER.info("Number of affected jobs: " + size);
            }
            IJobManager jobManager = ccs.getJobManager();
            for (JobId jobId : affectedJobIds) {
                JobRun run = jobManager.get(jobId);
                if (run != null) {
                    run.getExecutor().notifyNodeFailures(deadNodes);
                }
            }
        }
        if (!deadNodes.isEmpty()) {
            ccs.getContext().notifyNodeFailure(deadNodes);
        }
    } catch (HyracksException e) {
        LOGGER.log(Level.WARNING, "Uncaught exception on notifyNodeFailure", e);
    }
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) Collection(java.util.Collection) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) IJobManager(org.apache.hyracks.control.cc.job.IJobManager) JobId(org.apache.hyracks.api.job.JobId) JobRun(org.apache.hyracks.control.cc.job.JobRun)

Example 5 with INodeManager

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

the class CliDeployBinaryWork method doRun.

@Override
public void doRun() {
    try {
        if (deploymentId == null) {
            deploymentId = new DeploymentId(UUID.randomUUID().toString());
        }
        /**
             * Deploy for the cluster controller
             */
        DeploymentUtils.deploy(deploymentId, binaryURLs, ccs.getContext().getJobSerializerDeserializerContainer(), ccs.getServerContext(), false);
        /**
             * Deploy for the node controllers
             */
        INodeManager nodeManager = ccs.getNodeManager();
        Collection<String> nodeIds = nodeManager.getAllNodeIds();
        final DeploymentRun dRun = new DeploymentRun(nodeIds);
        /** The following call prevents a user to deploy with the same deployment id simultaneously. */
        ccs.addDeploymentRun(deploymentId, dRun);
        /***
             * deploy binaries to each node controller
             */
        for (NodeControllerState ncs : nodeManager.getAllNodeControllerStates()) {
            ncs.getNodeController().deployBinary(deploymentId, binaryURLs);
        }
        ccs.getExecutor().execute(new Runnable() {

            @Override
            public void run() {
                try {
                    /**
                         * wait for completion
                         */
                    dRun.waitForCompletion();
                    ccs.removeDeploymentRun(deploymentId);
                    callback.setValue(deploymentId);
                } catch (Exception e) {
                    callback.setException(e);
                }
            }
        });
    } catch (Exception e) {
        callback.setException(e);
    }
}
Also used : INodeManager(org.apache.hyracks.control.cc.cluster.INodeManager) DeploymentId(org.apache.hyracks.api.deployment.DeploymentId) DeploymentRun(org.apache.hyracks.control.common.deployment.DeploymentRun) 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