File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/appmaster Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 7575@ Private
7676@ Unstable
7777public abstract class AMSimulator extends TaskRunner .Task {
78+ private static final long FINISH_TIME_NOT_INITIALIZED = Long .MIN_VALUE ;
7879 // resource manager
7980 protected ResourceManager rm ;
8081 // main
@@ -102,7 +103,7 @@ public abstract class AMSimulator extends TaskRunner.Task {
102103 protected long traceStartTimeMS ;
103104 protected long traceFinishTimeMS ;
104105 protected long simulateStartTimeMS ;
105- protected long simulateFinishTimeMS ;
106+ protected long simulateFinishTimeMS = FINISH_TIME_NOT_INITIALIZED ;
106107 // whether tracked in Metrics
107108 protected boolean isTracked ;
108109 // progress
@@ -226,6 +227,16 @@ public void middleStep() throws Exception {
226227
227228 @ Override
228229 public void lastStep () throws Exception {
230+ if (simulateFinishTimeMS != FINISH_TIME_NOT_INITIALIZED ) {
231+ // The finish time is already recorded.
232+ // Different value from zero means lastStep was called before.
233+ // We want to prevent lastStep to be called more than once.
234+ // See YARN-10427 for more details.
235+ LOG .warn ("Method AMSimulator#lastStep was already called. " +
236+ "Skipping execution of method for application: {}" , appId );
237+ return ;
238+ }
239+
229240 LOG .info ("Application {} is shutting down." , appId );
230241 // unregister tracking
231242 if (isTracked ) {
You can’t perform that action at this time.
0 commit comments