use of org.apache.hyracks.control.cc.NodeControllerState 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.NodeControllerState in project asterixdb by apache.
the class NodeManagerTest method mockNodeControllerState.
private NodeControllerState mockNodeControllerState(String nodeId, boolean invalidIpAddr) {
NodeControllerState ncState = mock(NodeControllerState.class);
String ipAddr = invalidIpAddr ? "255.255.255:255" : "127.0.0.2";
NetworkAddress dataAddr = new NetworkAddress(ipAddr, 1001);
NetworkAddress resultAddr = new NetworkAddress(ipAddr, 1002);
NetworkAddress msgAddr = new NetworkAddress(ipAddr, 1003);
when(ncState.getCapacity()).thenReturn(new NodeCapacity(NODE_MEMORY_SIZE, NODE_CORES));
when(ncState.getDataPort()).thenReturn(dataAddr);
when(ncState.getDatasetPort()).thenReturn(resultAddr);
when(ncState.getMessagingPort()).thenReturn(msgAddr);
NCConfig ncConfig = new NCConfig(nodeId);
ncConfig.setDataPublicAddress(ipAddr);
when(ncState.getNCConfig()).thenReturn(ncConfig);
return ncState;
}
use of org.apache.hyracks.control.cc.NodeControllerState in project asterixdb by apache.
the class NodeManagerTest method testException.
@Test
public void testException() throws HyracksException {
IResourceManager resourceManager = new ResourceManager();
INodeManager nodeManager = new NodeManager(makeCCConfig(), resourceManager);
NodeControllerState ncState1 = mockNodeControllerState(NODE1, true);
boolean invalidNetworkAddress = false;
// Verifies states after a failure during adding nodes.
try {
nodeManager.addNode(NODE1, ncState1);
} catch (HyracksException e) {
invalidNetworkAddress = e.getErrorCode() == ErrorCode.INVALID_NETWORK_ADDRESS;
}
Assert.assertTrue(invalidNetworkAddress);
// Verifies that the cluster is empty.
verifyEmptyCluster(resourceManager, nodeManager);
}
use of org.apache.hyracks.control.cc.NodeControllerState 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.NodeControllerState in project asterixdb by apache.
the class GetNodeDetailsJSONWork method doRun.
@Override
protected void doRun() throws Exception {
if (nodeId == null) {
// null nodeId is a request for CC
detail = getCCDetails();
if (includeConfig) {
ConfigUtils.addConfigToJSON(detail, ccConfig.getAppConfig(), CC_SECTIONS);
detail.putPOJO("app.args", ccConfig.getAppArgs());
}
} else {
NodeControllerState ncs = nodeManager.getNodeControllerState(nodeId);
if (ncs != null) {
detail = ncs.toDetailedJSON(includeStats, includeConfig);
if (includeConfig) {
final NCConfig ncConfig = ncs.getNCConfig();
ConfigUtils.addConfigToJSON(detail, ncConfig.getConfigManager().getNodeEffectiveConfig(nodeId), NC_SECTIONS);
detail.putPOJO("app.args", ncConfig.getAppArgs());
}
}
}
if (callback != null) {
callback.setValue(detail == null ? null : om.writeValueAsString(detail));
}
}
Aggregations