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);
}
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);
}
}
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);
}
}
Aggregations