@Test
  public void testGetMaxMetricForTaskTypeAndMetricName() {
    Map<Integer, TonyTaskData> taskDataMap = new TreeMap<>();
    TonyTaskData worker0Data = new TonyTaskData("worker", 0);
    TonyTaskData worker1Data = new TonyTaskData("worker", 1);

    double worker0MaxGPUUtilization = 20.0d;
    double worker1MaxGPUUtilization = 21.0d;
    double worker0MaxGPUFBMemoryUsage = 22.0d;
    double worker1MaxGPUFBMemoryUsage = 23.0d;
    double worker0MaxGPUMainMemoryUsage = 2.0d;
    double worker1MaxGPUMainMemoryUsage = -1.0d;

    worker0Data.setMetrics(ImmutableList.of(
        new Metric(Constants.MAX_GPU_UTILIZATION, worker0MaxGPUUtilization),
        new Metric(Constants.MAX_GPU_FB_MEMORY_USAGE, worker0MaxGPUFBMemoryUsage),
        new Metric(Constants.MAX_GPU_MAIN_MEMORY_USAGE, worker0MaxGPUMainMemoryUsage)
    ));
    worker1Data.setMetrics(ImmutableList.of(
        new Metric(Constants.MAX_GPU_UTILIZATION, worker1MaxGPUUtilization),
        new Metric(Constants.MAX_GPU_FB_MEMORY_USAGE, worker1MaxGPUFBMemoryUsage),
        new Metric(Constants.MAX_GPU_MAIN_MEMORY_USAGE, worker1MaxGPUMainMemoryUsage)
    ));

    taskDataMap.put(0, worker0Data);
    taskDataMap.put(1, worker1Data);

    Assert.assertEquals(worker1MaxGPUUtilization,
        TonyUtils.getMaxMetricForTaskTypeAndMetricName(ImmutableMap.of("worker", taskDataMap), "worker",
            Constants.MAX_GPU_UTILIZATION), 0);
    Assert.assertEquals(worker1MaxGPUFBMemoryUsage,
        TonyUtils.getMaxMetricForTaskTypeAndMetricName(ImmutableMap.of("worker", taskDataMap), "worker",
            Constants.MAX_GPU_FB_MEMORY_USAGE), 0);
    Assert.assertEquals(worker0MaxGPUMainMemoryUsage,
        TonyUtils.getMaxMetricForTaskTypeAndMetricName(ImmutableMap.of("worker", taskDataMap), "worker",
            Constants.MAX_GPU_MAIN_MEMORY_USAGE), 0);
  }
Worker 0 is missing metrics, but worker 1 has metrics; we should use worker 1's
max memory metrics.
test/com/linkedin/drelephant/tony/util/TonyUtilsTest.java