YARN-4732. *ProcessTree classes have too many whitespace issues
(cherry picked from commit 7fae4c68e6
)
This commit is contained in:
parent
283e44f978
commit
95b59c17a7
|
@ -48,8 +48,8 @@ public class ProcessTree {
|
||||||
private static final String SIGTERM_STR = "SIGTERM";
|
private static final String SIGTERM_STR = "SIGTERM";
|
||||||
private static final String SIGKILL_STR = "SIGKILL";
|
private static final String SIGKILL_STR = "SIGKILL";
|
||||||
|
|
||||||
|
|
||||||
public static final boolean isSetsidAvailable = isSetsidSupported();
|
public static final boolean isSetsidAvailable = isSetsidSupported();
|
||||||
|
|
||||||
private static boolean isSetsidSupported() {
|
private static boolean isSetsidSupported() {
|
||||||
ShellCommandExecutor shexec = null;
|
ShellCommandExecutor shexec = null;
|
||||||
boolean setsidSupported = true;
|
boolean setsidSupported = true;
|
||||||
|
@ -114,7 +114,6 @@ public class ProcessTree {
|
||||||
sigKill(pgrpId, true, sleeptimeBeforeSigkill, inBackground);
|
sigKill(pgrpId, true, sleeptimeBeforeSigkill, inBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a specified signal to the specified pid
|
* Send a specified signal to the specified pid
|
||||||
*
|
*
|
||||||
|
@ -215,7 +214,6 @@ public class ProcessTree {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Kills the process(OR process group) by sending the signal SIGKILL
|
/** Kills the process(OR process group) by sending the signal SIGKILL
|
||||||
* @param pid Process id(OR process group id) of to-be-deleted-process
|
* @param pid Process id(OR process group id) of to-be-deleted-process
|
||||||
* @param isProcessGroup Is pid a process group id of to-be-deleted-processes
|
* @param isProcessGroup Is pid a process group id of to-be-deleted-processes
|
||||||
|
@ -327,7 +325,6 @@ public class ProcessTree {
|
||||||
return (shexec.getExitCode() == 0 ? true : false);
|
return (shexec.getExitCode() == 0 ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper thread class that kills process-tree with SIGKILL in background
|
* Helper thread class that kills process-tree with SIGKILL in background
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -409,13 +409,11 @@ public class ProcfsBasedProcessTree extends ResourceCalculatorProcessTree {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug(procMemInfo.toString());
|
LOG.debug(procMemInfo.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
total *= KB_TO_BYTES; // convert to bytes
|
total *= KB_TO_BYTES; // convert to bytes
|
||||||
|
|
|
@ -45,7 +45,6 @@ public class WindowsBasedProcessTree extends ResourceCalculatorProcessTree {
|
||||||
long cpuTimeMsDelta; // delta of cpuTime since last update
|
long cpuTimeMsDelta; // delta of cpuTime since last update
|
||||||
int age = 1;
|
int age = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String taskProcessId = null;
|
private String taskProcessId = null;
|
||||||
private long cpuTimeMs = UNAVAILABLE;
|
private long cpuTimeMs = UNAVAILABLE;
|
||||||
private Map<String, ProcessInfo> processTree =
|
private Map<String, ProcessInfo> processTree =
|
||||||
|
|
|
@ -227,7 +227,6 @@ public class TestProcfsBasedProcessTree {
|
||||||
// ProcessTree is gone now. Any further calls should be sane.
|
// ProcessTree is gone now. Any further calls should be sane.
|
||||||
p.updateProcessTree();
|
p.updateProcessTree();
|
||||||
Assert.assertFalse("ProcessTree must have been gone", isAlive(pid));
|
Assert.assertFalse("ProcessTree must have been gone", isAlive(pid));
|
||||||
|
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
"vmem for the gone-process is " + p.getVirtualMemorySize()
|
"vmem for the gone-process is " + p.getVirtualMemorySize()
|
||||||
+ " . It should be zero.", p.getVirtualMemorySize() == 0);
|
+ " . It should be zero.", p.getVirtualMemorySize() == 0);
|
||||||
|
@ -581,7 +580,6 @@ public class TestProcfsBasedProcessTree {
|
||||||
// verify virtual memory
|
// verify virtual memory
|
||||||
Assert.assertEquals("Virtual memory does not match", 700000L,
|
Assert.assertEquals("Virtual memory does not match", 700000L,
|
||||||
processTree.getVirtualMemorySize());
|
processTree.getVirtualMemorySize());
|
||||||
|
|
||||||
Assert.assertEquals("Virtual memory (old API) does not match", 700000L,
|
Assert.assertEquals("Virtual memory (old API) does not match", 700000L,
|
||||||
processTree.getCumulativeVmem());
|
processTree.getCumulativeVmem());
|
||||||
|
|
||||||
|
@ -602,10 +600,8 @@ public class TestProcfsBasedProcessTree {
|
||||||
processTree.updateProcessTree();
|
processTree.updateProcessTree();
|
||||||
Assert.assertEquals("vmem does not include new process",
|
Assert.assertEquals("vmem does not include new process",
|
||||||
1200000L, processTree.getVirtualMemorySize());
|
1200000L, processTree.getVirtualMemorySize());
|
||||||
|
|
||||||
Assert.assertEquals("vmem (old API) does not include new process",
|
Assert.assertEquals("vmem (old API) does not include new process",
|
||||||
1200000L, processTree.getCumulativeVmem());
|
1200000L, processTree.getCumulativeVmem());
|
||||||
|
|
||||||
if (!smapEnabled) {
|
if (!smapEnabled) {
|
||||||
long cumuRssMem =
|
long cumuRssMem =
|
||||||
ProcfsBasedProcessTree.PAGE_SIZE > 0
|
ProcfsBasedProcessTree.PAGE_SIZE > 0
|
||||||
|
@ -632,7 +628,6 @@ public class TestProcfsBasedProcessTree {
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
"vmem (old API) shouldn't have included new process", 700000L,
|
"vmem (old API) shouldn't have included new process", 700000L,
|
||||||
processTree.getCumulativeVmem(1));
|
processTree.getCumulativeVmem(1));
|
||||||
|
|
||||||
if (!smapEnabled) {
|
if (!smapEnabled) {
|
||||||
long cumuRssMem =
|
long cumuRssMem =
|
||||||
ProcfsBasedProcessTree.PAGE_SIZE > 0
|
ProcfsBasedProcessTree.PAGE_SIZE > 0
|
||||||
|
@ -645,7 +640,6 @@ public class TestProcfsBasedProcessTree {
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
"rssmem (old API) shouldn't have included new process", cumuRssMem,
|
"rssmem (old API) shouldn't have included new process", cumuRssMem,
|
||||||
processTree.getCumulativeRssmem(1));
|
processTree.getCumulativeRssmem(1));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
"rssmem shouldn't have included new process",
|
"rssmem shouldn't have included new process",
|
||||||
|
@ -676,12 +670,10 @@ public class TestProcfsBasedProcessTree {
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
"vmem shouldn't have included new processes", 700000L,
|
"vmem shouldn't have included new processes", 700000L,
|
||||||
processTree.getVirtualMemorySize(2));
|
processTree.getVirtualMemorySize(2));
|
||||||
|
|
||||||
// verify old API
|
// verify old API
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
"vmem (old API) shouldn't have included new processes", 700000L,
|
"vmem (old API) shouldn't have included new processes", 700000L,
|
||||||
processTree.getCumulativeVmem(2));
|
processTree.getCumulativeVmem(2));
|
||||||
|
|
||||||
if (!smapEnabled) {
|
if (!smapEnabled) {
|
||||||
long cumuRssMem =
|
long cumuRssMem =
|
||||||
ProcfsBasedProcessTree.PAGE_SIZE > 0
|
ProcfsBasedProcessTree.PAGE_SIZE > 0
|
||||||
|
|
|
@ -44,7 +44,6 @@ public class TestResourceCalculatorProcessTree {
|
||||||
public long getRssMemorySize(int age) {
|
public long getRssMemorySize(int age) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public long getCumulativeRssmem(int age) {
|
public long getCumulativeRssmem(int age) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -62,7 +62,6 @@ public class TestWindowsBasedProcessTree {
|
||||||
assertTrue(pTree.getCumulativeVmem() == 2048);
|
assertTrue(pTree.getCumulativeVmem() == 2048);
|
||||||
assertTrue(pTree.getVirtualMemorySize(0) == 2048);
|
assertTrue(pTree.getVirtualMemorySize(0) == 2048);
|
||||||
assertTrue(pTree.getCumulativeVmem(0) == 2048);
|
assertTrue(pTree.getCumulativeVmem(0) == 2048);
|
||||||
|
|
||||||
assertTrue(pTree.getRssMemorySize() == 2048);
|
assertTrue(pTree.getRssMemorySize() == 2048);
|
||||||
assertTrue(pTree.getCumulativeRssmem() == 2048);
|
assertTrue(pTree.getCumulativeRssmem() == 2048);
|
||||||
assertTrue(pTree.getRssMemorySize(0) == 2048);
|
assertTrue(pTree.getRssMemorySize(0) == 2048);
|
||||||
|
|
Loading…
Reference in New Issue