Search in sources :

Example 1 with NCConfig

use of org.apache.hyracks.control.common.controllers.NCConfig in project asterixdb by apache.

the class AbstractIntegrationTest method init.

@BeforeClass
public static void init() throws Exception {
    CCConfig ccConfig = new CCConfig();
    ccConfig.setClientListenAddress("127.0.0.1");
    ccConfig.setClientListenPort(39000);
    ccConfig.setClusterListenAddress("127.0.0.1");
    ccConfig.setClusterListenPort(39001);
    ccConfig.setProfileDumpPeriod(10000);
    FileUtils.deleteQuietly(new File("target" + File.separator + "data"));
    FileUtils.copyDirectory(new File("data"), new File(joinPath("target", "data")));
    File outDir = new File("target" + File.separator + "ClusterController");
    outDir.mkdirs();
    File ccRoot = File.createTempFile(AbstractIntegrationTest.class.getName(), ".data", outDir);
    ccRoot.delete();
    ccRoot.mkdir();
    ccConfig.setRootDir(ccRoot.getAbsolutePath());
    cc = new ClusterControllerService(ccConfig);
    cc.start();
    NCConfig ncConfig1 = new NCConfig(NC1_ID);
    ncConfig1.setClusterAddress("localhost");
    ncConfig1.setClusterPort(39001);
    ncConfig1.setClusterListenAddress("127.0.0.1");
    ncConfig1.setDataListenAddress("127.0.0.1");
    ncConfig1.setResultListenAddress("127.0.0.1");
    ncConfig1.setIODevices(new String[] { joinPath(System.getProperty("user.dir"), "target", "data", "device0") });
    nc1 = new NodeControllerService(ncConfig1);
    nc1.start();
    NCConfig ncConfig2 = new NCConfig(NC2_ID);
    ncConfig2.setClusterAddress("localhost");
    ncConfig2.setClusterPort(39001);
    ncConfig2.setClusterListenAddress("127.0.0.1");
    ncConfig2.setDataListenAddress("127.0.0.1");
    ncConfig2.setResultListenAddress("127.0.0.1");
    ncConfig2.setIODevices(new String[] { joinPath(System.getProperty("user.dir"), "target", "data", "device1") });
    nc2 = new NodeControllerService(ncConfig2);
    nc2.start();
    hcc = new HyracksConnection(ccConfig.getClientListenAddress(), ccConfig.getClientListenPort());
    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("Starting CC in " + ccRoot.getAbsolutePath());
    }
}
Also used : NodeControllerService(org.apache.hyracks.control.nc.NodeControllerService) CCConfig(org.apache.hyracks.control.common.controllers.CCConfig) NCConfig(org.apache.hyracks.control.common.controllers.NCConfig) HyracksConnection(org.apache.hyracks.api.client.HyracksConnection) File(java.io.File) ClusterControllerService(org.apache.hyracks.control.cc.ClusterControllerService) BeforeClass(org.junit.BeforeClass)

Example 2 with NCConfig

use of org.apache.hyracks.control.common.controllers.NCConfig in project asterixdb by apache.

the class NCDriver method main.

public static void main(String[] args) {
    try {
        final String nodeId = ConfigUtils.getOptionValue(args, NCConfig.Option.NODE_ID);
        final ConfigManager configManager = new ConfigManager(args);
        INCApplication application = getApplication(args);
        application.registerConfig(configManager);
        NCConfig ncConfig = new NCConfig(nodeId, configManager);
        final NodeControllerService ncService = new NodeControllerService(ncConfig, application);
        ncService.start();
        while (true) {
            Thread.sleep(10000);
        }
    } catch (CmdLineException e) {
        LOGGER.log(Level.FINE, "Exception parsing command line: " + Arrays.toString(args), e);
        System.exit(2);
    } catch (Exception e) {
        LOGGER.log(Level.SEVERE, "Exiting NCDriver due to exception", e);
        System.exit(1);
    }
}
Also used : INCApplication(org.apache.hyracks.api.application.INCApplication) NCConfig(org.apache.hyracks.control.common.controllers.NCConfig) ConfigManager(org.apache.hyracks.control.common.config.ConfigManager) CmdLineException(org.kohsuke.args4j.CmdLineException) CmdLineException(org.kohsuke.args4j.CmdLineException) IOException(java.io.IOException)

Example 3 with NCConfig

use of org.apache.hyracks.control.common.controllers.NCConfig in project asterixdb by apache.

the class PredistributedJobsTest method init.

@BeforeClass
public static void init() throws Exception {
    CCConfig ccConfig = new CCConfig();
    ccConfig.setClientListenAddress("127.0.0.1");
    ccConfig.setClientListenPort(39000);
    ccConfig.setClusterListenAddress("127.0.0.1");
    ccConfig.setClusterListenPort(39001);
    ccConfig.setProfileDumpPeriod(10000);
    FileUtils.deleteQuietly(new File(joinPath("target", "data")));
    FileUtils.copyDirectory(new File("data"), new File(joinPath("target", "data")));
    File outDir = new File("target" + File.separator + "ClusterController");
    outDir.mkdirs();
    File ccRoot = File.createTempFile(AbstractIntegrationTest.class.getName(), ".data", outDir);
    ccRoot.delete();
    ccRoot.mkdir();
    ccConfig.setRootDir(ccRoot.getAbsolutePath());
    ClusterControllerService ccBase = new ClusterControllerService(ccConfig);
    cc = Mockito.spy(ccBase);
    cc.start();
    NCConfig ncConfig1 = new NCConfig(NC1_ID);
    ncConfig1.setClusterAddress("localhost");
    ncConfig1.setClusterPort(39001);
    ncConfig1.setClusterListenAddress("127.0.0.1");
    ncConfig1.setDataListenAddress("127.0.0.1");
    ncConfig1.setResultListenAddress("127.0.0.1");
    ncConfig1.setResultSweepThreshold(5000);
    ncConfig1.setIODevices(new String[] { joinPath(System.getProperty("user.dir"), "target", "data", "device0") });
    NodeControllerService nc1Base = new NodeControllerService(ncConfig1);
    nc1 = Mockito.spy(nc1Base);
    nc1.start();
    NCConfig ncConfig2 = new NCConfig(NC2_ID);
    ncConfig2.setClusterAddress("localhost");
    ncConfig2.setClusterPort(39001);
    ncConfig2.setClusterListenAddress("127.0.0.1");
    ncConfig2.setDataListenAddress("127.0.0.1");
    ncConfig2.setResultListenAddress("127.0.0.1");
    ncConfig2.setResultSweepThreshold(5000);
    ncConfig2.setIODevices(new String[] { joinPath(System.getProperty("user.dir"), "target", "data", "device1") });
    NodeControllerService nc2Base = new NodeControllerService(ncConfig2);
    nc2 = Mockito.spy(nc2Base);
    nc2.start();
    hcc = new HyracksConnection(ccConfig.getClientListenAddress(), ccConfig.getClientListenPort());
    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("Starting CC in " + ccRoot.getAbsolutePath());
    }
}
Also used : NodeControllerService(org.apache.hyracks.control.nc.NodeControllerService) CCConfig(org.apache.hyracks.control.common.controllers.CCConfig) NCConfig(org.apache.hyracks.control.common.controllers.NCConfig) HyracksConnection(org.apache.hyracks.api.client.HyracksConnection) File(java.io.File) ClusterControllerService(org.apache.hyracks.control.cc.ClusterControllerService) BeforeClass(org.junit.BeforeClass)

Example 4 with NCConfig

use of org.apache.hyracks.control.common.controllers.NCConfig 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;
}
Also used : NetworkAddress(org.apache.hyracks.api.comm.NetworkAddress) NodeCapacity(org.apache.hyracks.api.job.resource.NodeCapacity) NCConfig(org.apache.hyracks.control.common.controllers.NCConfig) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState)

Example 5 with NCConfig

use of org.apache.hyracks.control.common.controllers.NCConfig 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));
    }
}
Also used : NCConfig(org.apache.hyracks.control.common.controllers.NCConfig) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState)

Aggregations

NCConfig (org.apache.hyracks.control.common.controllers.NCConfig)11 NodeControllerService (org.apache.hyracks.control.nc.NodeControllerService)7 HyracksConnection (org.apache.hyracks.api.client.HyracksConnection)6 ClusterControllerService (org.apache.hyracks.control.cc.ClusterControllerService)6 CCConfig (org.apache.hyracks.control.common.controllers.CCConfig)6 File (java.io.File)4 BeforeClass (org.junit.BeforeClass)3 NodeControllerState (org.apache.hyracks.control.cc.NodeControllerState)2 IOException (java.io.IOException)1 MetadataProperties (org.apache.asterix.common.config.MetadataProperties)1 TransactionProperties (org.apache.asterix.common.config.TransactionProperties)1 Cluster (org.apache.asterix.event.schema.cluster.Cluster)1 Node (org.apache.asterix.event.schema.cluster.Node)1 INCApplication (org.apache.hyracks.api.application.INCApplication)1 NetworkAddress (org.apache.hyracks.api.comm.NetworkAddress)1 NodeCapacity (org.apache.hyracks.api.job.resource.NodeCapacity)1 ConfigManager (org.apache.hyracks.control.common.config.ConfigManager)1 CmdLineException (org.kohsuke.args4j.CmdLineException)1