YARN-7671. Improve Diagonstic message for stop yarn native service. Contributed by Chandni Singh

This commit is contained in:
Jian He 2018-01-12 14:04:15 -08:00
parent 3d65dbe032
commit c05b84703b
2 changed files with 9 additions and 8 deletions

View File

@ -22,6 +22,7 @@
import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
import org.apache.hadoop.ipc.Server; import org.apache.hadoop.ipc.Server;
import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.util.ExitUtil; import org.apache.hadoop.util.ExitUtil;
import org.apache.hadoop.yarn.api.ApplicationConstants; import org.apache.hadoop.yarn.api.ApplicationConstants;
@ -117,7 +118,10 @@ public GetStatusResponseProto getStatus(GetStatusRequestProto request)
@Override @Override
public StopResponseProto stop(StopRequestProto requestProto) public StopResponseProto stop(StopRequestProto requestProto)
throws IOException, YarnException { throws IOException, YarnException {
LOG.info("Stop the service."); LOG.info("Stop the service by {}", UserGroupInformation.getCurrentUser());
context.scheduler.getDiagnostics()
.append("Stopped by user " + UserGroupInformation.getCurrentUser());
// Stop the service in 2 seconds delay to make sure this rpc call is completed. // Stop the service in 2 seconds delay to make sure this rpc call is completed.
// shutdown hook will be executed which will stop AM gracefully. // shutdown hook will be executed which will stop AM gracefully.
Thread thread = new Thread() { Thread thread = new Thread() {

View File

@ -262,13 +262,10 @@ public void serviceStop() throws Exception {
serviceTimelinePublisher serviceTimelinePublisher
.serviceAttemptUnregistered(context, diagnostics.toString()); .serviceAttemptUnregistered(context, diagnostics.toString());
} }
String msg = diagnostics.toString() amRMClient.unregisterApplicationMaster(FinalApplicationStatus.ENDED,
+ "Navigate to the failed component for more details."; diagnostics.toString(), "");
amRMClient LOG.info("Service {} unregistered with RM, with attemptId = {} " +
.unregisterApplicationMaster(FinalApplicationStatus.ENDED, msg, ""); ", diagnostics = {} ", app.getName(), context.attemptId, diagnostics);
LOG.info("Service " + app.getName()
+ " unregistered with RM, with attemptId = " + context.attemptId
+ ", diagnostics = " + diagnostics);
super.serviceStop(); super.serviceStop();
} }