forked from ShubhamGupta29/dr-elephant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request linkedin#573 from linkedin/fix-negative-task-duration
Fix linkedin#572: MysqlDataTruncation error when no TASK_FINISHED event for a TonY task
- Loading branch information
Showing
5 changed files
with
119 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.linkedin.drelephant.tony.util; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.google.common.collect.ImmutableMap; | ||
import com.linkedin.drelephant.tony.data.TonyTaskData; | ||
import com.linkedin.tony.Constants; | ||
import com.linkedin.tony.events.Metric; | ||
import java.util.Map; | ||
import java.util.TreeMap; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
|
||
public class TonyUtilsTest { | ||
/** | ||
* Worker 0 is missing metrics, but worker 1 has metrics; we should use worker 1's | ||
* max memory metrics. | ||
*/ | ||
@Test | ||
public void testGetMaxMemorySomeTasksMissingMetrics() { | ||
Map<Integer, TonyTaskData> taskDataMap = new TreeMap<>(); | ||
TonyTaskData worker0Data = new TonyTaskData("worker", 0); | ||
TonyTaskData worker1Data = new TonyTaskData("worker", 1); | ||
double worker1MaxMemoryBytes = 123d; | ||
worker1Data.setMetrics(ImmutableList.of(new Metric(Constants.MAX_MEMORY_BYTES, worker1MaxMemoryBytes))); | ||
|
||
taskDataMap.put(0, worker0Data); | ||
taskDataMap.put(1, worker1Data); | ||
|
||
Assert.assertEquals(worker1MaxMemoryBytes, | ||
TonyUtils.getMaxMemoryBytesUsedForTaskType(ImmutableMap.of("worker", taskDataMap), "worker"), 0); | ||
} | ||
} |