YARN-8290. SystemMetricsPublisher.appACLsUpdated should be invoked after application information is published to ATS to avoid "User is not set in the application report" Exception. (Eric Yang via wangda)
Change-Id: I0ac6ddd19740d1aa7dd07111cd11af71ddc2fcaf
(cherry picked from commit bd15d2396e
)
This commit is contained in:
parent
7c3f236783
commit
6aaf33e50c
|
@ -31,7 +31,6 @@ import org.apache.hadoop.ipc.Server;
|
||||||
import org.apache.hadoop.security.AccessControlException;
|
import org.apache.hadoop.security.AccessControlException;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.util.StringUtils;
|
import org.apache.hadoop.util.StringUtils;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
|
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
|
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationTimeoutType;
|
import org.apache.hadoop.yarn.api.records.ApplicationTimeoutType;
|
||||||
|
@ -466,10 +465,6 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
||||||
// Inform the ACLs Manager
|
// Inform the ACLs Manager
|
||||||
this.applicationACLsManager.addApplication(applicationId,
|
this.applicationACLsManager.addApplication(applicationId,
|
||||||
submissionContext.getAMContainerSpec().getApplicationACLs());
|
submissionContext.getAMContainerSpec().getApplicationACLs());
|
||||||
String appViewACLs = submissionContext.getAMContainerSpec()
|
|
||||||
.getApplicationACLs().get(ApplicationAccessType.VIEW_APP);
|
|
||||||
rmContext.getSystemMetricsPublisher().appACLsUpdated(
|
|
||||||
application, appViewACLs, System.currentTimeMillis());
|
|
||||||
return application;
|
return application;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.apache.hadoop.ipc.CallerContext;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.security.token.Token;
|
import org.apache.hadoop.security.token.Token;
|
||||||
import org.apache.hadoop.util.StringInterner;
|
import org.apache.hadoop.util.StringInterner;
|
||||||
|
import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
||||||
|
@ -1987,6 +1988,10 @@ public class RMAppImpl implements RMApp, Recoverable {
|
||||||
private void sendATSCreateEvent() {
|
private void sendATSCreateEvent() {
|
||||||
rmContext.getRMApplicationHistoryWriter().applicationStarted(this);
|
rmContext.getRMApplicationHistoryWriter().applicationStarted(this);
|
||||||
rmContext.getSystemMetricsPublisher().appCreated(this, this.startTime);
|
rmContext.getSystemMetricsPublisher().appCreated(this, this.startTime);
|
||||||
|
String appViewACLs = submissionContext.getAMContainerSpec()
|
||||||
|
.getApplicationACLs().get(ApplicationAccessType.VIEW_APP);
|
||||||
|
rmContext.getSystemMetricsPublisher().appACLsUpdated(
|
||||||
|
this, appViewACLs, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Private
|
@Private
|
||||||
|
|
|
@ -856,9 +856,6 @@ public class TestAppManager{
|
||||||
Assert.assertNotNull("app is null", app);
|
Assert.assertNotNull("app is null", app);
|
||||||
Assert.assertEquals("app id doesn't match", appId, app.getApplicationId());
|
Assert.assertEquals("app id doesn't match", appId, app.getApplicationId());
|
||||||
Assert.assertEquals("app state doesn't match", RMAppState.NEW, app.getState());
|
Assert.assertEquals("app state doesn't match", RMAppState.NEW, app.getState());
|
||||||
verify(metricsPublisher).appACLsUpdated(
|
|
||||||
any(RMApp.class), any(String.class), anyLong());
|
|
||||||
|
|
||||||
// wait for event to be processed
|
// wait for event to be processed
|
||||||
int timeoutSecs = 0;
|
int timeoutSecs = 0;
|
||||||
while ((getAppEventType() == RMAppEventType.KILL) &&
|
while ((getAppEventType() == RMAppEventType.KILL) &&
|
||||||
|
@ -867,7 +864,6 @@ public class TestAppManager{
|
||||||
}
|
}
|
||||||
Assert.assertEquals("app event type sent is wrong", RMAppEventType.START,
|
Assert.assertEquals("app event type sent is wrong", RMAppEventType.START,
|
||||||
getAppEventType());
|
getAppEventType());
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -766,6 +766,7 @@ public class TestRMRestart extends ParameterizedSchedulerTestBase {
|
||||||
RMApp loadedApp0 = rm2.getRMContext().getRMApps().get(app0.getApplicationId());
|
RMApp loadedApp0 = rm2.getRMContext().getRMApps().get(app0.getApplicationId());
|
||||||
rm2.waitForState(app0.getApplicationId(), RMAppState.FAILED);
|
rm2.waitForState(app0.getApplicationId(), RMAppState.FAILED);
|
||||||
rm2.waitForState(am0.getApplicationAttemptId(), RMAppAttemptState.FAILED);
|
rm2.waitForState(am0.getApplicationAttemptId(), RMAppAttemptState.FAILED);
|
||||||
|
Assert.assertEquals(app0.getUser(), loadedApp0.getUser());
|
||||||
// no new attempt is created.
|
// no new attempt is created.
|
||||||
Assert.assertEquals(1, loadedApp0.getAppAttempts().size());
|
Assert.assertEquals(1, loadedApp0.getAppAttempts().size());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue