Search in sources :

Example 1 with DeploymentRun

use of org.apache.hyracks.control.common.deployment.DeploymentRun in project asterixdb by apache.

the class NotifyDeployBinaryWork method runWork.

@Override
public void runWork() {
    // Triggered remotely by a NC to notify that the NC is deployed.
    DeploymentRun dRun = ccs.getDeploymentRun(deploymentId);
    dRun.notifyDeploymentStatus(nodeId, deploymentStatus);
}
Also used : DeploymentRun(org.apache.hyracks.control.common.deployment.DeploymentRun)

Example 2 with DeploymentRun

use of org.apache.hyracks.control.common.deployment.DeploymentRun 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)

Example 3 with DeploymentRun

use of org.apache.hyracks.control.common.deployment.DeploymentRun in project asterixdb by apache.

the class CliUnDeployBinaryWork method doRun.

@Override
public void doRun() {
    try {
        if (deploymentId == null) {
            deploymentId = new DeploymentId(UUID.randomUUID().toString());
        }
        /**
             * Deploy for the cluster controller
             */
        DeploymentUtils.undeploy(deploymentId, ccs.getContext().getJobSerializerDeserializerContainer(), ccs.getServerContext());
        /**
             * 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 undeploy with the same deployment id simultaneously. */
        ccs.addDeploymentRun(deploymentId, dRun);
        /***
             * deploy binaries to each node controller
             */
        for (NodeControllerState ncs : nodeManager.getAllNodeControllerStates()) {
            ncs.getNodeController().undeployBinary(deploymentId);
        }
        ccs.getExecutor().execute(new Runnable() {

            @Override
            public void run() {
                try {
                    /**
                         * wait for completion
                         */
                    dRun.waitForCompletion();
                    ccs.removeDeploymentRun(deploymentId);
                    callback.setValue(null);
                } catch (Exception e) {
                    callback.setException(e);
                }
            }
        });
    } catch (Exception e) {
        throw new RuntimeException(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

DeploymentRun (org.apache.hyracks.control.common.deployment.DeploymentRun)3 DeploymentId (org.apache.hyracks.api.deployment.DeploymentId)2 NodeControllerState (org.apache.hyracks.control.cc.NodeControllerState)2 INodeManager (org.apache.hyracks.control.cc.cluster.INodeManager)2