use of org.apache.myriad.scheduler.yarn.interceptor.CompositeInterceptor in project incubator-myriad by apache.
the class MyriadCapacityScheduler method setRMContext.
/**
* Register an event handler that receives {@link RMNodeEvent} events.
* This event handler is registered ahead of RM's own event handler for RMNodeEvents.
* For e.g. myriad can inspect a node's HB (RMNodeStatusEvent) before the HB is handled by
* RM and the scheduler.
*
* @param rmContext
*/
@Override
public synchronized void setRMContext(RMContext rmContext) {
this.rmContext = rmContext;
this.yarnSchedulerInterceptor = new CompositeInterceptor();
rmNodeEventHandler = new RMNodeEventHandler(yarnSchedulerInterceptor, rmContext);
rmContext.getDispatcher().register(RMNodeEventType.class, rmNodeEventHandler);
super.setRMContext(rmContext);
}
use of org.apache.myriad.scheduler.yarn.interceptor.CompositeInterceptor in project incubator-myriad by apache.
the class MyriadOperationsTest method initialize.
private MyriadOperations initialize() throws Exception {
resetStoreState();
SchedulerState sState = TestObjectFactory.getSchedulerState(cfg, "tmp/myriad-operations-test");
sState.setFrameworkId(FrameworkID.newBuilder().setValue("mock-framework").build());
AbstractYarnScheduler<FiCaSchedulerApp, FiCaSchedulerNode> scheduler = TestObjectFactory.getYarnScheduler();
MyriadDriverManager manager = TestObjectFactory.getMyriadDriverManager();
MyriadWebServer webServer = TestObjectFactory.getMyriadWebServer(cfg);
CompositeInterceptor registry = new CompositeInterceptor();
LeastAMNodesFirstPolicy policy = new LeastAMNodesFirstPolicy(registry, scheduler, sState);
manager.startDriver();
return new MyriadOperations(cfg, sState, policy, manager, webServer, generateRMContext(scheduler));
}
use of org.apache.myriad.scheduler.yarn.interceptor.CompositeInterceptor in project incubator-myriad by apache.
the class MyriadFairScheduler method setRMContext.
/**
* Register an event handler that receives {@link RMNodeEvent} events.
* This event handler is registered ahead of RM's own event handler for RMNodeEvents.
* For e.g. myriad can inspect a node's HB (RMNodeStatusEvent) before the HB is handled by
* RM and the scheduler.
*
* @param rmContext
*/
@Override
public synchronized void setRMContext(RMContext rmContext) {
this.rmContext = rmContext;
this.yarnSchedulerInterceptor = new CompositeInterceptor();
rmNodeEventHandler = new RMNodeEventHandler(yarnSchedulerInterceptor, rmContext);
rmContext.getDispatcher().register(RMNodeEventType.class, rmNodeEventHandler);
super.setRMContext(rmContext);
}
use of org.apache.myriad.scheduler.yarn.interceptor.CompositeInterceptor 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());
}
use of org.apache.myriad.scheduler.yarn.interceptor.CompositeInterceptor 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));
}
Aggregations