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