YARN-5805. Add isDebugEnabled check for debug logs in nodemanager (Bibin A Chundatt via Varun Saxena)
This commit is contained in:
parent
1c5708f6de
commit
2f0a101ab9
|
@ -556,9 +556,10 @@ public class DefaultContainerExecutor extends ContainerExecutor {
|
||||||
String user = ctx.getUser();
|
String user = ctx.getUser();
|
||||||
String pid = ctx.getPid();
|
String pid = ctx.getPid();
|
||||||
Signal signal = ctx.getSignal();
|
Signal signal = ctx.getSignal();
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Sending signal " + signal.getValue() + " to pid " + pid
|
LOG.debug("Sending signal " + signal.getValue() + " to pid " + pid
|
||||||
+ " as user " + user);
|
+ " as user " + user);
|
||||||
|
}
|
||||||
if (!containerIsAlive(pid)) {
|
if (!containerIsAlive(pid)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,9 @@ public class DeletionService extends AbstractService {
|
||||||
boolean error = false;
|
boolean error = false;
|
||||||
if (null == user) {
|
if (null == user) {
|
||||||
if (baseDirs == null || baseDirs.size() == 0) {
|
if (baseDirs == null || baseDirs.size() == 0) {
|
||||||
LOG.debug("NM deleting absolute path : " + subDir);
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("NM deleting absolute path : " + subDir);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
lfs.delete(subDir, true);
|
lfs.delete(subDir, true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -249,7 +251,9 @@ public class DeletionService extends AbstractService {
|
||||||
} else {
|
} else {
|
||||||
for (Path baseDir : baseDirs) {
|
for (Path baseDir : baseDirs) {
|
||||||
Path del = subDir == null? baseDir : new Path(baseDir, subDir);
|
Path del = subDir == null? baseDir : new Path(baseDir, subDir);
|
||||||
LOG.debug("NM deleting path : " + del);
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("NM deleting path : " + del);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
lfs.delete(del, true);
|
lfs.delete(del, true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -260,7 +264,10 @@ public class DeletionService extends AbstractService {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
LOG.debug("Deleting path: [" + subDir + "] as user: [" + user + "]");
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug(
|
||||||
|
"Deleting path: [" + subDir + "] as user: [" + user + "]");
|
||||||
|
}
|
||||||
if (baseDirs == null || baseDirs.size() == 0) {
|
if (baseDirs == null || baseDirs.size() == 0) {
|
||||||
delService.exec.deleteAsUser(new DeletionAsUserContext.Builder()
|
delService.exec.deleteAsUser(new DeletionAsUserContext.Builder()
|
||||||
.setUser(user)
|
.setUser(user)
|
||||||
|
|
|
@ -549,7 +549,9 @@ public class AMRMProxyService extends AbstractService implements
|
||||||
AMRMProxyService.this.stopApplication(event.getApplicationID());
|
AMRMProxyService.this.stopApplication(event.getApplicationID());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG.debug("AMRMProxy is ignoring event: " + event.getType());
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("AMRMProxy is ignoring event: " + event.getType());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -521,8 +521,10 @@ public class ApplicationImpl implements Application {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ApplicationId applicationID = event.getApplicationID();
|
ApplicationId applicationID = event.getApplicationID();
|
||||||
LOG.debug("Processing " + applicationID + " of type " + event.getType());
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug(
|
||||||
|
"Processing " + applicationID + " of type " + event.getType());
|
||||||
|
}
|
||||||
ApplicationState oldState = stateMachine.getCurrentState();
|
ApplicationState oldState = stateMachine.getCurrentState();
|
||||||
ApplicationState newState = null;
|
ApplicationState newState = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1631,8 +1631,9 @@ public class ContainerImpl implements Container {
|
||||||
this.writeLock.lock();
|
this.writeLock.lock();
|
||||||
|
|
||||||
ContainerId containerID = event.getContainerID();
|
ContainerId containerID = event.getContainerID();
|
||||||
LOG.debug("Processing " + containerID + " of type " + event.getType());
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Processing " + containerID + " of type " + event.getType());
|
||||||
|
}
|
||||||
ContainerState oldState = stateMachine.getCurrentState();
|
ContainerState oldState = stateMachine.getCurrentState();
|
||||||
ContainerState newState = null;
|
ContainerState newState = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -571,8 +571,9 @@ public class ContainerLaunch implements Callable<Integer> {
|
||||||
+ " No cleanup needed to be done");
|
+ " No cleanup needed to be done");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Marking container " + containerIdStr + " as inactive");
|
LOG.debug("Marking container " + containerIdStr + " as inactive");
|
||||||
|
}
|
||||||
// this should ensure that if the container process has not launched
|
// this should ensure that if the container process has not launched
|
||||||
// by this time, it will never be launched
|
// by this time, it will never be launched
|
||||||
exec.deactivateContainer(containerId);
|
exec.deactivateContainer(containerId);
|
||||||
|
@ -596,10 +597,10 @@ public class ContainerLaunch implements Callable<Integer> {
|
||||||
// kill process
|
// kill process
|
||||||
if (processId != null) {
|
if (processId != null) {
|
||||||
String user = container.getUser();
|
String user = container.getUser();
|
||||||
LOG.debug("Sending signal to pid " + processId
|
if (LOG.isDebugEnabled()) {
|
||||||
+ " as user " + user
|
LOG.debug("Sending signal to pid " + processId + " as user " + user
|
||||||
+ " for container " + containerIdStr);
|
+ " for container " + containerIdStr);
|
||||||
|
}
|
||||||
final Signal signal = sleepDelayBeforeSigKill > 0
|
final Signal signal = sleepDelayBeforeSigKill > 0
|
||||||
? Signal.TERM
|
? Signal.TERM
|
||||||
: Signal.KILL;
|
: Signal.KILL;
|
||||||
|
@ -611,12 +612,11 @@ public class ContainerLaunch implements Callable<Integer> {
|
||||||
.setPid(processId)
|
.setPid(processId)
|
||||||
.setSignal(signal)
|
.setSignal(signal)
|
||||||
.build());
|
.build());
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Sent signal " + signal + " to pid " + processId
|
LOG.debug("Sent signal " + signal + " to pid " + processId
|
||||||
+ " as user " + user
|
+ " as user " + user + " for container " + containerIdStr
|
||||||
+ " for container " + containerIdStr
|
+ ", result=" + (result ? "success" : "failed"));
|
||||||
+ ", result=" + (result? "success" : "failed"));
|
}
|
||||||
|
|
||||||
if (sleepDelayBeforeSigKill > 0) {
|
if (sleepDelayBeforeSigKill > 0) {
|
||||||
new DelayedProcessKiller(container, user,
|
new DelayedProcessKiller(container, user,
|
||||||
processId, sleepDelayBeforeSigKill, Signal.KILL, exec).start();
|
processId, sleepDelayBeforeSigKill, Signal.KILL, exec).start();
|
||||||
|
@ -744,8 +744,10 @@ public class ContainerLaunch implements Callable<Integer> {
|
||||||
String containerIdStr =
|
String containerIdStr =
|
||||||
container.getContainerId().toString();
|
container.getContainerId().toString();
|
||||||
String processId = null;
|
String processId = null;
|
||||||
LOG.debug("Accessing pid for container " + containerIdStr
|
if (LOG.isDebugEnabled()) {
|
||||||
+ " from pid file " + pidFilePath);
|
LOG.debug("Accessing pid for container " + containerIdStr
|
||||||
|
+ " from pid file " + pidFilePath);
|
||||||
|
}
|
||||||
int sleepCounter = 0;
|
int sleepCounter = 0;
|
||||||
final int sleepInterval = 100;
|
final int sleepInterval = 100;
|
||||||
|
|
||||||
|
@ -754,8 +756,10 @@ public class ContainerLaunch implements Callable<Integer> {
|
||||||
while (true) {
|
while (true) {
|
||||||
processId = ProcessIdFileReader.getProcessId(pidFilePath);
|
processId = ProcessIdFileReader.getProcessId(pidFilePath);
|
||||||
if (processId != null) {
|
if (processId != null) {
|
||||||
LOG.debug("Got pid " + processId + " for container "
|
if (LOG.isDebugEnabled()) {
|
||||||
+ containerIdStr);
|
LOG.debug(
|
||||||
|
"Got pid " + processId + " for container " + containerIdStr);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if ((sleepCounter*sleepInterval) > maxKillWaitTime) {
|
else if ((sleepCounter*sleepInterval) > maxKillWaitTime) {
|
||||||
|
|
|
@ -190,8 +190,9 @@ public class LocalizedResource implements EventHandler<ResourceEvent> {
|
||||||
this.writeLock.lock();
|
this.writeLock.lock();
|
||||||
|
|
||||||
Path resourcePath = event.getLocalResourceRequest().getPath();
|
Path resourcePath = event.getLocalResourceRequest().getPath();
|
||||||
LOG.debug("Processing " + resourcePath + " of type " + event.getType());
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Processing " + resourcePath + " of type " + event.getType());
|
||||||
|
}
|
||||||
ResourceState oldState = this.stateMachine.getCurrentState();
|
ResourceState oldState = this.stateMachine.getCurrentState();
|
||||||
ResourceState newState = null;
|
ResourceState newState = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -41,7 +41,9 @@ public class LocalizerTokenSelector implements
|
||||||
LOG.debug("Using localizerTokenSelector.");
|
LOG.debug("Using localizerTokenSelector.");
|
||||||
|
|
||||||
for (Token<? extends TokenIdentifier> token : tokens) {
|
for (Token<? extends TokenIdentifier> token : tokens) {
|
||||||
LOG.debug("Token of kind " + token.getKind() + " is found");
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Token of kind " + token.getKind() + " is found");
|
||||||
|
}
|
||||||
if (LocalizerTokenIdentifier.KIND.equals(token.getKind())) {
|
if (LocalizerTokenIdentifier.KIND.equals(token.getKind())) {
|
||||||
return (Token<LocalizerTokenIdentifier>) token;
|
return (Token<LocalizerTokenIdentifier>) token;
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,8 +424,10 @@ public class ContainersMonitorImpl extends AbstractService implements
|
||||||
if (pId != null) {
|
if (pId != null) {
|
||||||
// pId will be null, either if the container is not spawned yet
|
// pId will be null, either if the container is not spawned yet
|
||||||
// or if the container's pid is removed from ContainerExecutor
|
// or if the container's pid is removed from ContainerExecutor
|
||||||
LOG.debug("Tracking ProcessTree " + pId
|
if (LOG.isDebugEnabled()) {
|
||||||
+ " for the first time");
|
LOG.debug("Tracking ProcessTree " + pId
|
||||||
|
+ " for the first time");
|
||||||
|
}
|
||||||
|
|
||||||
ResourceCalculatorProcessTree pt =
|
ResourceCalculatorProcessTree pt =
|
||||||
ResourceCalculatorProcessTree.getResourceCalculatorProcessTree(pId, processTreeClass, conf);
|
ResourceCalculatorProcessTree.getResourceCalculatorProcessTree(pId, processTreeClass, conf);
|
||||||
|
@ -457,8 +459,10 @@ public class ContainersMonitorImpl extends AbstractService implements
|
||||||
continue; // processTree cannot be tracked
|
continue; // processTree cannot be tracked
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.debug("Constructing ProcessTree for : PID = " + pId
|
if (LOG.isDebugEnabled()) {
|
||||||
+ " ContainerId = " + containerId);
|
LOG.debug("Constructing ProcessTree for : PID = " + pId
|
||||||
|
+ " ContainerId = " + containerId);
|
||||||
|
}
|
||||||
ResourceCalculatorProcessTree pTree = ptInfo.getProcessTree();
|
ResourceCalculatorProcessTree pTree = ptInfo.getProcessTree();
|
||||||
pTree.updateProcessTree(); // update process-tree
|
pTree.updateProcessTree(); // update process-tree
|
||||||
long currentVmemUsage = pTree.getVirtualMemorySize();
|
long currentVmemUsage = pTree.getVirtualMemorySize();
|
||||||
|
|
|
@ -191,8 +191,10 @@ public class NMTokenSecretManagerInNM extends BaseNMTokenSecretManager {
|
||||||
public synchronized void appFinished(ApplicationId appId) {
|
public synchronized void appFinished(ApplicationId appId) {
|
||||||
List<ApplicationAttemptId> appAttemptList = appToAppAttemptMap.get(appId);
|
List<ApplicationAttemptId> appAttemptList = appToAppAttemptMap.get(appId);
|
||||||
if (appAttemptList != null) {
|
if (appAttemptList != null) {
|
||||||
LOG.debug("Removing application attempts NMToken keys for application "
|
if (LOG.isDebugEnabled()) {
|
||||||
+ appId);
|
LOG.debug("Removing application attempts NMToken keys for application "
|
||||||
|
+ appId);
|
||||||
|
}
|
||||||
for (ApplicationAttemptId appAttemptId : appAttemptList) {
|
for (ApplicationAttemptId appAttemptId : appAttemptList) {
|
||||||
removeAppAttemptKey(appAttemptId);
|
removeAppAttemptKey(appAttemptId);
|
||||||
}
|
}
|
||||||
|
@ -226,8 +228,10 @@ public class NMTokenSecretManagerInNM extends BaseNMTokenSecretManager {
|
||||||
if (oldKey == null
|
if (oldKey == null
|
||||||
|| oldKey.getMasterKey().getKeyId() != identifier.getKeyId()) {
|
|| oldKey.getMasterKey().getKeyId() != identifier.getKeyId()) {
|
||||||
// Update key only if it is modified.
|
// Update key only if it is modified.
|
||||||
LOG.debug("NMToken key updated for application attempt : "
|
if (LOG.isDebugEnabled()) {
|
||||||
+ identifier.getApplicationAttemptId().toString());
|
LOG.debug("NMToken key updated for application attempt : "
|
||||||
|
+ identifier.getApplicationAttemptId().toString());
|
||||||
|
}
|
||||||
if (identifier.getKeyId() == currentMasterKey.getMasterKey()
|
if (identifier.getKeyId() == currentMasterKey.getMasterKey()
|
||||||
.getKeyId()) {
|
.getKeyId()) {
|
||||||
updateAppAttemptKey(appAttemptId, currentMasterKey);
|
updateAppAttemptKey(appAttemptId, currentMasterKey);
|
||||||
|
@ -243,7 +247,9 @@ public class NMTokenSecretManagerInNM extends BaseNMTokenSecretManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void setNodeId(NodeId nodeId) {
|
public synchronized void setNodeId(NodeId nodeId) {
|
||||||
LOG.debug("updating nodeId : " + nodeId);
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("updating nodeId : " + nodeId);
|
||||||
|
}
|
||||||
this.nodeId = nodeId;
|
this.nodeId = nodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,9 @@ public class ProcessIdFileReader {
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
throw new IOException("Trying to access process id from a null path");
|
throw new IOException("Trying to access process id from a null path");
|
||||||
}
|
}
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Accessing pid from pid file " + path);
|
LOG.debug("Accessing pid from pid file " + path);
|
||||||
|
}
|
||||||
String processId = null;
|
String processId = null;
|
||||||
BufferedReader bufReader = null;
|
BufferedReader bufReader = null;
|
||||||
|
|
||||||
|
@ -97,9 +98,10 @@ public class ProcessIdFileReader {
|
||||||
bufReader.close();
|
bufReader.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.debug("Got pid "
|
if (LOG.isDebugEnabled()) {
|
||||||
+ (processId != null? processId : "null")
|
LOG.debug("Got pid " + (processId != null ? processId : "null")
|
||||||
+ " from path " + path);
|
+ " from path " + path);
|
||||||
|
}
|
||||||
return processId;
|
return processId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue