YARN-10427. Duplicate Job IDs in SLS output (#3809). Contributed by Szilard Nemeth

This commit is contained in:
Szilard Nemeth 2021-12-17 00:34:16 +01:00 committed by GitHub
parent 8d214cb785
commit a967033a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -75,6 +75,7 @@ import org.slf4j.LoggerFactory;
@Private
@Unstable
public abstract class AMSimulator extends TaskRunner.Task {
private static final long FINISH_TIME_NOT_INITIALIZED = Long.MIN_VALUE;
// resource manager
protected ResourceManager rm;
// main
@ -102,7 +103,7 @@ public abstract class AMSimulator extends TaskRunner.Task {
protected long traceStartTimeMS;
protected long traceFinishTimeMS;
protected long simulateStartTimeMS;
protected long simulateFinishTimeMS;
protected long simulateFinishTimeMS = FINISH_TIME_NOT_INITIALIZED;
// whether tracked in Metrics
protected boolean isTracked;
// progress
@ -226,6 +227,16 @@ public abstract class AMSimulator extends TaskRunner.Task {
@Override
public void lastStep() throws Exception {
if (simulateFinishTimeMS != FINISH_TIME_NOT_INITIALIZED) {
// The finish time is already recorded.
// Different value from zero means lastStep was called before.
// We want to prevent lastStep to be called more than once.
// See YARN-10427 for more details.
LOG.warn("Method AMSimulator#lastStep was already called. " +
"Skipping execution of method for application: {}", appId);
return;
}
LOG.info("Application {} is shutting down.", appId);
// unregister tracking
if (isTracked) {