Package org.apache.hadoop.mapred.gridmix.emulators.resourceusage

Examples of org.apache.hadoop.mapred.gridmix.emulators.resourceusage.ResourceUsageMatcher


  /**
   * Test {@link ResourceUsageMatcher}.
   */
  @Test
  public void testResourceUsageMatcher() throws Exception {
    ResourceUsageMatcher matcher = new ResourceUsageMatcher();
    Configuration conf = new Configuration();
    conf.setClass(ResourceUsageMatcher.RESOURCE_USAGE_EMULATION_PLUGINS,
                  TestResourceUsageEmulatorPlugin.class,
                  ResourceUsageEmulatorPlugin.class);
    long currentTime = System.currentTimeMillis();
   
    matcher.configure(conf, null, null, null);
   
    matcher.matchResourceUsage();
   
    String id = TestResourceUsageEmulatorPlugin.DEFAULT_IDENTIFIER;
    long result =
      TestResourceUsageEmulatorPlugin.testInitialization(id, conf);
    assertTrue("Resource usage matcher failed to initialize the configured"
               + " plugin", result > currentTime);
    result = TestResourceUsageEmulatorPlugin.testEmulation(id, conf);
    assertTrue("Resource usage matcher failed to load and emulate the"
               + " configured plugin", result > currentTime);
   
    // test plugin order to first emulate cpu and then others
    conf.setStrings(ResourceUsageMatcher.RESOURCE_USAGE_EMULATION_PLUGINS,
                    TestCpu.class.getName() + "," + TestOthers.class.getName());
   
    matcher.configure(conf, null, null, null);

    // test the initialization order
    long time1 =
           TestResourceUsageEmulatorPlugin.testInitialization(TestCpu.ID, conf);
    long time2 =
           TestResourceUsageEmulatorPlugin.testInitialization(TestOthers.ID,
                                                              conf);
    assertTrue("Resource usage matcher failed to initialize the configured"
               + " plugins in order", time1 < time2);
   
    matcher.matchResourceUsage();

    // Note that the cpu usage emulator plugin is configured 1st and then the
    // others plugin.
    time1 =
      TestResourceUsageEmulatorPlugin.testInitialization(TestCpu.ID, conf);
View Full Code Here


  /**
   * Test {@link ResourceUsageMatcher}.
   */
  @Test
  public void testResourceUsageMatcher() throws Exception {
    ResourceUsageMatcher matcher = new ResourceUsageMatcher();
    Configuration conf = new Configuration();
    conf.setClass(ResourceUsageMatcher.RESOURCE_USAGE_EMULATION_PLUGINS,
                  TestResourceUsageEmulatorPlugin.class,
                  ResourceUsageEmulatorPlugin.class);
    long currentTime = System.currentTimeMillis();
   
    matcher.configure(conf, null, null, null);
   
    matcher.matchResourceUsage();
   
    String id = TestResourceUsageEmulatorPlugin.DEFAULT_IDENTIFIER;
    long result =
      TestResourceUsageEmulatorPlugin.testInitialization(id, conf);
    assertTrue("Resource usage matcher failed to initialize the configured"
               + " plugin", result > currentTime);
    result = TestResourceUsageEmulatorPlugin.testEmulation(id, conf);
    assertTrue("Resource usage matcher failed to load and emulate the"
               + " configured plugin", result > currentTime);
   
    // test plugin order to first emulate cpu and then others
    conf.setStrings(ResourceUsageMatcher.RESOURCE_USAGE_EMULATION_PLUGINS,
                    TestCpu.class.getName() + "," + TestOthers.class.getName());
   
    matcher.configure(conf, null, null, null);

    // test the initialization order
    long time1 =
           TestResourceUsageEmulatorPlugin.testInitialization(TestCpu.ID, conf);
    long time2 =
           TestResourceUsageEmulatorPlugin.testInitialization(TestOthers.ID,
                                                              conf);
    assertTrue("Resource usage matcher failed to initialize the configured"
               + " plugins in order", time1 < time2);
   
    matcher.matchResourceUsage();

    // Note that the cpu usage emulator plugin is configured 1st and then the
    // others plugin.
    time1 =
      TestResourceUsageEmulatorPlugin.testInitialization(TestCpu.ID, conf);
View Full Code Here

          return context.getProgress();
        }
      };
     
      // instantiate a resource-usage-matcher
      matcher = new ResourceUsageMatcher();
      matcher.configure(conf, plugin, metrics, progress);
    }
View Full Code Here

  /**
   * Test {@link ResourceUsageMatcher}.
   */
  @Test
  public void testResourceUsageMatcher() throws Exception {
    ResourceUsageMatcher matcher = new ResourceUsageMatcher();
    Configuration conf = new Configuration();
    conf.setClass(ResourceUsageMatcher.RESOURCE_USAGE_EMULATION_PLUGINS,
                  TestResourceUsageEmulatorPlugin.class,
                  ResourceUsageEmulatorPlugin.class);
    long currentTime = System.currentTimeMillis();
   
    matcher.configure(conf, null, null, null);
   
    matcher.matchResourceUsage();
   
    String id = TestResourceUsageEmulatorPlugin.DEFAULT_IDENTIFIER;
    long result =
      TestResourceUsageEmulatorPlugin.testInitialization(id, conf);
    assertTrue("Resource usage matcher failed to initialize the configured"
               + " plugin", result > currentTime);
    result = TestResourceUsageEmulatorPlugin.testEmulation(id, conf);
    assertTrue("Resource usage matcher failed to load and emulate the"
               + " configured plugin", result > currentTime);
   
    // test plugin order to first emulate cpu and then others
    conf.setStrings(ResourceUsageMatcher.RESOURCE_USAGE_EMULATION_PLUGINS,
                    TestCpu.class.getName() + "," + TestOthers.class.getName());
   
    matcher.configure(conf, null, null, null);

    // test the initialization order
    long time1 =
           TestResourceUsageEmulatorPlugin.testInitialization(TestCpu.ID, conf);
    long time2 =
           TestResourceUsageEmulatorPlugin.testInitialization(TestOthers.ID,
                                                              conf);
    assertTrue("Resource usage matcher failed to initialize the configured"
               + " plugins in order", time1 < time2);
   
    matcher.matchResourceUsage();

    // Note that the cpu usage emulator plugin is configured 1st and then the
    // others plugin.
    time1 =
      TestResourceUsageEmulatorPlugin.testInitialization(TestCpu.ID, conf);
View Full Code Here

      // set the other parameters
      this.sleepTime = conf.getLong(SLEEP_CONFIG, DEFAULT_SLEEP_TIME);
      progress = new BoostingProgress(context);
     
      // instantiate a resource-usage-matcher
      matcher = new ResourceUsageMatcher();
      matcher.configure(conf, plugin, metrics, progress);
    }
View Full Code Here

      // set the other parameters
      this.sleepTime = conf.getLong(SLEEP_CONFIG, DEFAULT_SLEEP_TIME);
      progress = new BoostingProgress(context);
     
      // instantiate a resource-usage-matcher
      matcher = new ResourceUsageMatcher();
      matcher.configure(conf, plugin, metrics, progress);
    }
View Full Code Here

  /**
   * Test {@link ResourceUsageMatcher}.
   */
  @Test
  public void testResourceUsageMatcher() throws Exception {
    ResourceUsageMatcher matcher = new ResourceUsageMatcher();
    Configuration conf = new Configuration();
    conf.setClass(ResourceUsageMatcher.RESOURCE_USAGE_EMULATION_PLUGINS,
                  TestResourceUsageEmulatorPlugin.class,
                  ResourceUsageEmulatorPlugin.class);
    long currentTime = System.currentTimeMillis();
   
    matcher.configure(conf, null, null, null);
   
    matcher.matchResourceUsage();
   
    String id = TestResourceUsageEmulatorPlugin.DEFAULT_IDENTIFIER;
    long result =
      TestResourceUsageEmulatorPlugin.testInitialization(id, conf);
    assertTrue("Resource usage matcher failed to initialize the configured"
               + " plugin", result > currentTime);
    result = TestResourceUsageEmulatorPlugin.testEmulation(id, conf);
    assertTrue("Resource usage matcher failed to load and emulate the"
               + " configured plugin", result > currentTime);
   
    // test plugin order to first emulate cpu and then others
    conf.setStrings(ResourceUsageMatcher.RESOURCE_USAGE_EMULATION_PLUGINS,
                    TestCpu.class.getName() + "," + TestOthers.class.getName());
   
    matcher.configure(conf, null, null, null);

    // test the initialization order
    long time1 =
           TestResourceUsageEmulatorPlugin.testInitialization(TestCpu.ID, conf);
    long time2 =
           TestResourceUsageEmulatorPlugin.testInitialization(TestOthers.ID,
                                                              conf);
    assertTrue("Resource usage matcher failed to initialize the configured"
               + " plugins in order", time1 < time2);
   
    matcher.matchResourceUsage();

    // Note that the cpu usage emulator plugin is configured 1st and then the
    // others plugin.
    time1 =
      TestResourceUsageEmulatorPlugin.testInitialization(TestCpu.ID, conf);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.mapred.gridmix.emulators.resourceusage.ResourceUsageMatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.