Search in sources :

Example 56 with Dispatcher

use of org.apache.hadoop.yarn.event.Dispatcher in project hadoop by apache.

the class TestNMWebServicesApps method addAppContainers.

private HashMap<String, String> addAppContainers(Application app) throws IOException {
    Dispatcher dispatcher = new AsyncDispatcher();
    ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId(app.getAppId(), 1);
    Container container1 = new MockContainer(appAttemptId, dispatcher, conf, app.getUser(), app.getAppId(), 1);
    Container container2 = new MockContainer(appAttemptId, dispatcher, conf, app.getUser(), app.getAppId(), 2);
    nmContext.getContainers().put(container1.getContainerId(), container1);
    nmContext.getContainers().put(container2.getContainerId(), container2);
    app.getContainers().put(container1.getContainerId(), container1);
    app.getContainers().put(container2.getContainerId(), container2);
    HashMap<String, String> hash = new HashMap<String, String>();
    hash.put(container1.getContainerId().toString(), container1.getContainerId().toString());
    hash.put(container2.getContainerId().toString(), container2.getContainerId().toString());
    return hash;
}
Also used : Container(org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container) GuiceContainer(com.sun.jersey.guice.spi.container.servlet.GuiceContainer) AsyncDispatcher(org.apache.hadoop.yarn.event.AsyncDispatcher) HashMap(java.util.HashMap) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) AsyncDispatcher(org.apache.hadoop.yarn.event.AsyncDispatcher) Dispatcher(org.apache.hadoop.yarn.event.Dispatcher)

Aggregations

Dispatcher (org.apache.hadoop.yarn.event.Dispatcher)56 Test (org.junit.Test)34 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)24 Configuration (org.apache.hadoop.conf.Configuration)23 AsyncDispatcher (org.apache.hadoop.yarn.event.AsyncDispatcher)19 ContainerLaunchContext (org.apache.hadoop.yarn.api.records.ContainerLaunchContext)14 EventHandler (org.apache.hadoop.yarn.event.EventHandler)14 FileContext (org.apache.hadoop.fs.FileContext)11 RMContext (org.apache.hadoop.yarn.server.resourcemanager.RMContext)11 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)10 Event (org.apache.hadoop.yarn.event.Event)10 NMContext (org.apache.hadoop.yarn.server.nodemanager.NodeManager.NMContext)10 DrainDispatcher (org.apache.hadoop.yarn.event.DrainDispatcher)8 Before (org.junit.Before)8 IOException (java.io.IOException)7 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)7 Container (org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container)7 Path (org.apache.hadoop.fs.Path)6 ArrayList (java.util.ArrayList)5 Resource (org.apache.hadoop.yarn.api.records.Resource)5