Search in sources :

Example 1 with MyriadConfiguration

use of org.apache.myriad.configuration.MyriadConfiguration in project incubator-myriad by apache.

the class NMHeartBeatHandlerTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    this.baseStateStoreDirectory = "/tmp/nm-heartbeat-handler-test";
    context = new MockRMContext();
    context.setDispatcher(TestObjectFactory.getMockDispatcher());
    context.setSystemMetricsPublisher(new SystemMetricsPublisher());
    profileZero = TestObjectFactory.getServiceResourceProfile("zero", Double.valueOf(0.0), Double.valueOf(0.0), Long.valueOf(0), Long.valueOf(0));
    profileSmall = TestObjectFactory.getServiceResourceProfile("small", Double.valueOf(2.0), Double.valueOf(2048.0), Long.valueOf(1), Long.valueOf(1024));
    nodeOne = TestObjectFactory.getRMNode("localhost-one", 8800, Resource.newInstance(0, 0));
    nodeTwo = TestObjectFactory.getRMNode("localhost-two", 8800, Resource.newInstance(1024, 2));
    sNodeOne = new FSSchedulerNode(nodeOne, false);
    sNodeTwo = new FSSchedulerNode(nodeTwo, false);
    nodeTaskOne = TestObjectFactory.getNodeTask("localhost-one", profileZero);
    nodeTaskTwo = TestObjectFactory.getNodeTask("localhost-two", profileSmall);
    ConcurrentMap<NodeId, RMNode> rmNodes = new ConcurrentHashMap<NodeId, RMNode>();
    rmNodes.put(nodeOne.getNodeID(), nodeOne);
    rmNodes.put(nodeTwo.getNodeID(), nodeTwo);
    context.setRMNodes(rmNodes);
    store = new NodeStore();
    store.add(sNodeOne);
    store.add(sNodeTwo);
    MyriadDriver driver = TestObjectFactory.getMyriadDriver(new MockSchedulerDriver());
    olManager = new OfferLifecycleManager(store, driver);
    state = TestObjectFactory.getSchedulerState(new MyriadConfiguration(), "/tmp/nm-heartbeat-handler-test");
    state.addNodes(Lists.newArrayList(nodeTaskOne, nodeTaskTwo));
    MyriadFairScheduler scheduler = TestObjectFactory.getMyriadFairScheduler(context);
    scheduler.addNode(sNodeOne);
    scheduler.addNode(sNodeTwo);
    manager = new YarnNodeCapacityManager(new CompositeInterceptor(), scheduler, context, driver, olManager, store, state, new TaskUtils(this.cfg));
    handler = new NMHeartBeatHandler(new CompositeInterceptor(), scheduler, driver, manager, olManager, store, state, cfg.getNodeManagerConfiguration());
}
Also used : MyriadDriver(org.apache.myriad.scheduler.MyriadDriver) CompositeInterceptor(org.apache.myriad.scheduler.yarn.interceptor.CompositeInterceptor) TaskUtils(org.apache.myriad.scheduler.TaskUtils) MockRMContext(org.apache.myriad.state.MockRMContext) MyriadFairScheduler(org.apache.myriad.scheduler.yarn.MyriadFairScheduler) FSSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSSchedulerNode) RMNode(org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode) MyriadConfiguration(org.apache.myriad.configuration.MyriadConfiguration) SystemMetricsPublisher(org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher) NodeId(org.apache.hadoop.yarn.api.records.NodeId) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) MockSchedulerDriver(org.apache.myriad.scheduler.MockSchedulerDriver) Before(org.junit.Before)

Example 2 with MyriadConfiguration

use of org.apache.myriad.configuration.MyriadConfiguration in project incubator-myriad by apache.

the class YarnNodeCapacityManagerTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    this.baseStateStoreDirectory = "/tmp/yarn-node-capacity-manager-test";
    context = new MockRMContext();
    context.setDispatcher(TestObjectFactory.getMockDispatcher());
    context.setSystemMetricsPublisher(new SystemMetricsPublisher());
    nodeOne = TestObjectFactory.getRMNode("localhost-one", 8800, Resource.newInstance(2048, 4));
    nodeTwo = TestObjectFactory.getRMNode("localhost-two", 8800, Resource.newInstance(1024, 2));
    sNodeOne = new FSSchedulerNode(nodeOne, false);
    sNodeTwo = new FSSchedulerNode(nodeTwo, false);
    containerOne = TestObjectFactory.getRMContainer(nodeOne, context, 1, 2, 1024);
    store = new NodeStore();
    store.add(sNodeOne);
    store.add(sNodeTwo);
    MyriadDriver driver = TestObjectFactory.getMyriadDriver(new MockSchedulerDriver());
    olManager = new OfferLifecycleManager(store, driver);
    state = TestObjectFactory.getSchedulerState(new MyriadConfiguration(), "/tmp/yarn-node-capacity-manager-test");
    MyriadFairScheduler scheduler = TestObjectFactory.getMyriadFairScheduler(context);
    scheduler.addNode(sNodeOne);
    scheduler.addNode(sNodeTwo);
    manager = new YarnNodeCapacityManager(new CompositeInterceptor(), scheduler, context, driver, olManager, store, state, new TaskUtils(this.cfg));
}
Also used : MyriadDriver(org.apache.myriad.scheduler.MyriadDriver) CompositeInterceptor(org.apache.myriad.scheduler.yarn.interceptor.CompositeInterceptor) TaskUtils(org.apache.myriad.scheduler.TaskUtils) MockRMContext(org.apache.myriad.state.MockRMContext) FSSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSSchedulerNode) MyriadConfiguration(org.apache.myriad.configuration.MyriadConfiguration) MyriadFairScheduler(org.apache.myriad.scheduler.yarn.MyriadFairScheduler) SystemMetricsPublisher(org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher) MockSchedulerDriver(org.apache.myriad.scheduler.MockSchedulerDriver) Before(org.junit.Before)

Example 3 with MyriadConfiguration

use of org.apache.myriad.configuration.MyriadConfiguration in project incubator-myriad by apache.

the class TestObjectFactory method getSchedulerState.

public static SchedulerState getSchedulerState(MyriadConfiguration cfg, String baseDir) throws Exception {
    MyriadStateStore store = TestObjectFactory.getStateStore(new Configuration(), baseDir);
    SchedulerState state = new SchedulerState(store);
    state.setFrameworkId(FrameworkID.newBuilder().setValue("mock-framework").build());
    return state;
}
Also used : MyriadStateStore(org.apache.myriad.state.MyriadStateStore) SchedulerState(org.apache.myriad.state.SchedulerState) Configuration(org.apache.hadoop.conf.Configuration) MyriadConfiguration(org.apache.myriad.configuration.MyriadConfiguration)

Example 4 with MyriadConfiguration

use of org.apache.myriad.configuration.MyriadConfiguration in project incubator-myriad by apache.

the class Main method initServiceConfigurations.

/**
 * Create ServiceProfile for any configured service
 *
 * @param cfg
 * @param injector
 */
private void initServiceConfigurations(MyriadConfiguration cfg, Injector injector) {
    LOGGER.info("Initializing initServiceConfigurations");
    ServiceProfileManager profileManager = injector.getInstance(ServiceProfileManager.class);
    Map<String, ServiceConfiguration> servicesConfigs = injector.getInstance(MyriadConfiguration.class).getServiceConfigurations();
    for (Map.Entry<String, ServiceConfiguration> entry : servicesConfigs.entrySet()) {
        final String taskPrefix = entry.getKey();
        ServiceConfiguration config = entry.getValue();
        final Double cpu = config.getCpus();
        final Double mem = config.getJvmMaxMemoryMB();
        final Map<String, Long> ports = config.getPorts();
        profileManager.add(new ServiceResourceProfile(taskPrefix, cpu, mem, ports));
    }
}
Also used : ServiceProfileManager(org.apache.myriad.scheduler.ServiceProfileManager) ServiceConfiguration(org.apache.myriad.configuration.ServiceConfiguration) MyriadConfiguration(org.apache.myriad.configuration.MyriadConfiguration) ServiceResourceProfile(org.apache.myriad.scheduler.ServiceResourceProfile) Map(java.util.Map)

Aggregations

MyriadConfiguration (org.apache.myriad.configuration.MyriadConfiguration)4 SystemMetricsPublisher (org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher)2 FSSchedulerNode (org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSSchedulerNode)2 MockSchedulerDriver (org.apache.myriad.scheduler.MockSchedulerDriver)2 MyriadDriver (org.apache.myriad.scheduler.MyriadDriver)2 TaskUtils (org.apache.myriad.scheduler.TaskUtils)2 MyriadFairScheduler (org.apache.myriad.scheduler.yarn.MyriadFairScheduler)2 CompositeInterceptor (org.apache.myriad.scheduler.yarn.interceptor.CompositeInterceptor)2 MockRMContext (org.apache.myriad.state.MockRMContext)2 Before (org.junit.Before)2 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Configuration (org.apache.hadoop.conf.Configuration)1 NodeId (org.apache.hadoop.yarn.api.records.NodeId)1 RMNode (org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode)1 ServiceConfiguration (org.apache.myriad.configuration.ServiceConfiguration)1 ServiceProfileManager (org.apache.myriad.scheduler.ServiceProfileManager)1 ServiceResourceProfile (org.apache.myriad.scheduler.ServiceResourceProfile)1 MyriadStateStore (org.apache.myriad.state.MyriadStateStore)1 SchedulerState (org.apache.myriad.state.SchedulerState)1