Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
@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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -226,6 +227,16 @@ public void middleStep() throws Exception {

@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) {
Expand Down