Skip to content

Commit

Permalink
Disable refreshMemoryBytesMetrics when running test cases on Mac (#654)
Browse files Browse the repository at this point in the history
Description:

Because ProcfsBasedProcessTree currently is supported only on Linux.
When running test cases on Mac, the resourceCalculator is null
and should be ignored.

Signed-off-by: zhangjunfan <junfan.zhang@outlook.com>
  • Loading branch information
zuston authored Mar 10, 2022
1 parent 1961403 commit 2f5089f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tony-core/src/main/java/com/linkedin/tony/TaskMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ private void refreshMetrics() {
}

private void refreshMemoryBytesMetrics() {
/**
* ProcfsBasedProcessTree currently is supported only on Linux.
* So when running test cases on Mac, the {@code resourceCalculator}
* is null and should be ignored.
*/
if (resourceCalculator == null) {
return;
}
resourceCalculator.updateProcessTree();
double memoryBytes = resourceCalculator.getRssMemorySize();
setMaxMetrics(MAX_MEMORY_BYTES_INDEX, memoryBytes);
Expand Down

0 comments on commit 2f5089f

Please sign in to comment.