();
- eventInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO,
- "test diagnostics info");
- eventInfo.put(ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO, -1);
- eventInfo.put(ContainerMetricsConstants.STATE_EVENT_INFO,
- ContainerState.COMPLETE.toString());
- tEvent.setEventInfo(eventInfo);
- entity.addEvent(tEvent);
- return entity;
- }
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java
index 807d2df..48189b3 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java
@@ -31,7 +31,6 @@
import org.apache.hadoop.yarn.server.applicationhistoryservice.webapp.AHSWebApp;
import org.apache.hadoop.yarn.server.timeline.security.TimelineAuthenticationFilterInitializer;
import org.junit.After;
-import org.junit.Assert;
import org.junit.Test;
import java.util.HashMap;
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java
deleted file mode 100644
index 552a5e5..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.applicationhistoryservice;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.junit.Assert;
-
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptHistoryData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationHistoryData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerHistoryData;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestFileSystemApplicationHistoryStore extends
- ApplicationHistoryStoreTestUtils {
-
- private static Log LOG = LogFactory
- .getLog(TestFileSystemApplicationHistoryStore.class.getName());
-
- private FileSystem fs;
- private Path fsWorkingPath;
-
- @Before
- public void setup() throws Exception {
- fs = new RawLocalFileSystem();
- initStore(fs);
- }
-
- private void initStore(final FileSystem fs) throws IOException,
- URISyntaxException {
- Configuration conf = new Configuration();
- fs.initialize(new URI("/"), conf);
- fsWorkingPath =
- new Path("target",
- TestFileSystemApplicationHistoryStore.class.getSimpleName());
- fs.delete(fsWorkingPath, true);
- conf.set(YarnConfiguration.FS_APPLICATION_HISTORY_STORE_URI,
- fsWorkingPath.toString());
- store = new FileSystemApplicationHistoryStore() {
- @Override
- protected FileSystem getFileSystem(Path path, Configuration conf) {
- return fs;
- }
- };
- store.init(conf);
- store.start();
- }
-
- @After
- public void tearDown() throws Exception {
- store.stop();
- fs.delete(fsWorkingPath, true);
- fs.close();
- }
-
- @Test
- public void testReadWriteHistoryData() throws IOException {
- LOG.info("Starting testReadWriteHistoryData");
- testWriteHistoryData(5);
- testReadHistoryData(5);
- }
-
- private void testWriteHistoryData(int num) throws IOException {
- testWriteHistoryData(num, false, false);
- }
-
- private void testWriteHistoryData(
- int num, boolean missingContainer, boolean missingApplicationAttempt)
- throws IOException {
- // write application history data
- for (int i = 1; i <= num; ++i) {
- ApplicationId appId = ApplicationId.newInstance(0, i);
- writeApplicationStartData(appId);
-
- // write application attempt history data
- for (int j = 1; j <= num; ++j) {
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, j);
- writeApplicationAttemptStartData(appAttemptId);
-
- if (missingApplicationAttempt && j == num) {
- continue;
- }
- // write container history data
- for (int k = 1; k <= num; ++k) {
- ContainerId containerId = ContainerId.newInstance(appAttemptId, k);
- writeContainerStartData(containerId);
- if (missingContainer && k == num) {
- continue;
- }
- writeContainerFinishData(containerId);
- }
- writeApplicationAttemptFinishData(appAttemptId);
- }
- writeApplicationFinishData(appId);
- }
- }
-
- private void testReadHistoryData(int num) throws IOException {
- testReadHistoryData(num, false, false);
- }
-
- private void testReadHistoryData(
- int num, boolean missingContainer, boolean missingApplicationAttempt)
- throws IOException {
- // read application history data
- Assert.assertEquals(num, store.getAllApplications().size());
- for (int i = 1; i <= num; ++i) {
- ApplicationId appId = ApplicationId.newInstance(0, i);
- ApplicationHistoryData appData = store.getApplication(appId);
- Assert.assertNotNull(appData);
- Assert.assertEquals(appId.toString(), appData.getApplicationName());
- Assert.assertEquals(appId.toString(), appData.getDiagnosticsInfo());
-
- // read application attempt history data
- Assert.assertEquals(num, store.getApplicationAttempts(appId).size());
- for (int j = 1; j <= num; ++j) {
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, j);
- ApplicationAttemptHistoryData attemptData =
- store.getApplicationAttempt(appAttemptId);
- Assert.assertNotNull(attemptData);
- Assert.assertEquals(appAttemptId.toString(), attemptData.getHost());
-
- if (missingApplicationAttempt && j == num) {
- Assert.assertNull(attemptData.getDiagnosticsInfo());
- continue;
- } else {
- Assert.assertEquals(appAttemptId.toString(),
- attemptData.getDiagnosticsInfo());
- }
-
- // read container history data
- Assert.assertEquals(num, store.getContainers(appAttemptId).size());
- for (int k = 1; k <= num; ++k) {
- ContainerId containerId = ContainerId.newInstance(appAttemptId, k);
- ContainerHistoryData containerData = store.getContainer(containerId);
- Assert.assertNotNull(containerData);
- Assert.assertEquals(Priority.newInstance(containerId.getId()),
- containerData.getPriority());
- if (missingContainer && k == num) {
- Assert.assertNull(containerData.getDiagnosticsInfo());
- } else {
- Assert.assertEquals(containerId.toString(),
- containerData.getDiagnosticsInfo());
- }
- }
- ContainerHistoryData masterContainer =
- store.getAMContainer(appAttemptId);
- Assert.assertNotNull(masterContainer);
- Assert.assertEquals(ContainerId.newInstance(appAttemptId, 1),
- masterContainer.getContainerId());
- }
- }
- }
-
- @Test
- public void testWriteAfterApplicationFinish() throws IOException {
- LOG.info("Starting testWriteAfterApplicationFinish");
- ApplicationId appId = ApplicationId.newInstance(0, 1);
- writeApplicationStartData(appId);
- writeApplicationFinishData(appId);
- // write application attempt history data
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, 1);
- try {
- writeApplicationAttemptStartData(appAttemptId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains("is not opened"));
- }
- try {
- writeApplicationAttemptFinishData(appAttemptId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains("is not opened"));
- }
- // write container history data
- ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
- try {
- writeContainerStartData(containerId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains("is not opened"));
- }
- try {
- writeContainerFinishData(containerId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains("is not opened"));
- }
- }
-
- @Test
- public void testMassiveWriteContainerHistoryData() throws IOException {
- LOG.info("Starting testMassiveWriteContainerHistoryData");
- long mb = 1024 * 1024;
- long usedDiskBefore = fs.getContentSummary(fsWorkingPath).getLength() / mb;
- ApplicationId appId = ApplicationId.newInstance(0, 1);
- writeApplicationStartData(appId);
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, 1);
- for (int i = 1; i <= 100000; ++i) {
- ContainerId containerId = ContainerId.newInstance(appAttemptId, i);
- writeContainerStartData(containerId);
- writeContainerFinishData(containerId);
- }
- writeApplicationFinishData(appId);
- long usedDiskAfter = fs.getContentSummary(fsWorkingPath).getLength() / mb;
- Assert.assertTrue((usedDiskAfter - usedDiskBefore) < 20);
- }
-
- @Test
- public void testMissingContainerHistoryData() throws IOException {
- LOG.info("Starting testMissingContainerHistoryData");
- testWriteHistoryData(3, true, false);
- testReadHistoryData(3, true, false);
- }
-
- @Test
- public void testMissingApplicationAttemptHistoryData() throws IOException {
- LOG.info("Starting testMissingApplicationAttemptHistoryData");
- testWriteHistoryData(3, false, true);
- testReadHistoryData(3, false, true);
- }
-
- @Test
- public void testInitExistingWorkingDirectoryInSafeMode() throws Exception {
- LOG.info("Starting testInitExistingWorkingDirectoryInSafeMode");
- tearDown();
-
- // Setup file system to inject startup conditions
- FileSystem fs = spy(new RawLocalFileSystem());
- doReturn(true).when(fs).isDirectory(any(Path.class));
-
- try {
- initStore(fs);
- } catch (Exception e) {
- Assert.fail("Exception should not be thrown: " + e);
- }
-
- // Make sure that directory creation was not attempted
- verify(fs, times(1)).isDirectory(any(Path.class));
- verify(fs, times(0)).mkdirs(any(Path.class));
- }
-
- @Test
- public void testInitNonExistingWorkingDirectoryInSafeMode() throws Exception {
- LOG.info("Starting testInitNonExistingWorkingDirectoryInSafeMode");
- tearDown();
-
- // Setup file system to inject startup conditions
- FileSystem fs = spy(new RawLocalFileSystem());
- doReturn(false).when(fs).isDirectory(any(Path.class));
- doThrow(new IOException()).when(fs).mkdirs(any(Path.class));
-
- try {
- initStore(fs);
- Assert.fail("Exception should have been thrown");
- } catch (Exception e) {
- // Expected failure
- }
-
- // Make sure that directory creation was attempted
- verify(fs, times(1)).isDirectory(any(Path.class));
- verify(fs, times(1)).mkdirs(any(Path.class));
- }
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java
deleted file mode 100644
index de561aa..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestMemoryApplicationHistoryStore.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.applicationhistoryservice;
-
-import java.io.IOException;
-
-import org.junit.Assert;
-
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptHistoryData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationHistoryData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerHistoryData;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestMemoryApplicationHistoryStore extends
- ApplicationHistoryStoreTestUtils {
-
- @Before
- public void setup() {
- store = new MemoryApplicationHistoryStore();
- }
-
- @Test
- public void testReadWriteApplicationHistory() throws Exception {
- // Out of order
- ApplicationId appId = ApplicationId.newInstance(0, 1);
- try {
- writeApplicationFinishData(appId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains(
- "is stored before the start information"));
- }
- // Normal
- int numApps = 5;
- for (int i = 1; i <= numApps; ++i) {
- appId = ApplicationId.newInstance(0, i);
- writeApplicationStartData(appId);
- writeApplicationFinishData(appId);
- }
- Assert.assertEquals(numApps, store.getAllApplications().size());
- for (int i = 1; i <= numApps; ++i) {
- appId = ApplicationId.newInstance(0, i);
- ApplicationHistoryData data = store.getApplication(appId);
- Assert.assertNotNull(data);
- Assert.assertEquals(appId.toString(), data.getApplicationName());
- Assert.assertEquals(appId.toString(), data.getDiagnosticsInfo());
- }
- // Write again
- appId = ApplicationId.newInstance(0, 1);
- try {
- writeApplicationStartData(appId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains("is already stored"));
- }
- try {
- writeApplicationFinishData(appId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains("is already stored"));
- }
- }
-
- @Test
- public void testReadWriteApplicationAttemptHistory() throws Exception {
- // Out of order
- ApplicationId appId = ApplicationId.newInstance(0, 1);
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, 1);
- try {
- writeApplicationAttemptFinishData(appAttemptId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains(
- "is stored before the start information"));
- }
- // Normal
- int numAppAttempts = 5;
- writeApplicationStartData(appId);
- for (int i = 1; i <= numAppAttempts; ++i) {
- appAttemptId = ApplicationAttemptId.newInstance(appId, i);
- writeApplicationAttemptStartData(appAttemptId);
- writeApplicationAttemptFinishData(appAttemptId);
- }
- Assert.assertEquals(numAppAttempts, store.getApplicationAttempts(appId)
- .size());
- for (int i = 1; i <= numAppAttempts; ++i) {
- appAttemptId = ApplicationAttemptId.newInstance(appId, i);
- ApplicationAttemptHistoryData data =
- store.getApplicationAttempt(appAttemptId);
- Assert.assertNotNull(data);
- Assert.assertEquals(appAttemptId.toString(), data.getHost());
- Assert.assertEquals(appAttemptId.toString(), data.getDiagnosticsInfo());
- }
- writeApplicationFinishData(appId);
- // Write again
- appAttemptId = ApplicationAttemptId.newInstance(appId, 1);
- try {
- writeApplicationAttemptStartData(appAttemptId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains("is already stored"));
- }
- try {
- writeApplicationAttemptFinishData(appAttemptId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains("is already stored"));
- }
- }
-
- @Test
- public void testReadWriteContainerHistory() throws Exception {
- // Out of order
- ApplicationId appId = ApplicationId.newInstance(0, 1);
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, 1);
- ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
- try {
- writeContainerFinishData(containerId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains(
- "is stored before the start information"));
- }
- // Normal
- writeApplicationAttemptStartData(appAttemptId);
- int numContainers = 5;
- for (int i = 1; i <= numContainers; ++i) {
- containerId = ContainerId.newInstance(appAttemptId, i);
- writeContainerStartData(containerId);
- writeContainerFinishData(containerId);
- }
- Assert
- .assertEquals(numContainers, store.getContainers(appAttemptId).size());
- for (int i = 1; i <= numContainers; ++i) {
- containerId = ContainerId.newInstance(appAttemptId, i);
- ContainerHistoryData data = store.getContainer(containerId);
- Assert.assertNotNull(data);
- Assert.assertEquals(Priority.newInstance(containerId.getId()),
- data.getPriority());
- Assert.assertEquals(containerId.toString(), data.getDiagnosticsInfo());
- }
- ContainerHistoryData masterContainer = store.getAMContainer(appAttemptId);
- Assert.assertNotNull(masterContainer);
- Assert.assertEquals(ContainerId.newInstance(appAttemptId, 1),
- masterContainer.getContainerId());
- writeApplicationAttemptFinishData(appAttemptId);
- // Write again
- containerId = ContainerId.newInstance(appAttemptId, 1);
- try {
- writeContainerStartData(containerId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains("is already stored"));
- }
- try {
- writeContainerFinishData(containerId);
- Assert.fail();
- } catch (IOException e) {
- Assert.assertTrue(e.getMessage().contains("is already stored"));
- }
- }
-
- @Test
- public void testMassiveWriteContainerHistory() throws IOException {
- long mb = 1024 * 1024;
- Runtime runtime = Runtime.getRuntime();
- long usedMemoryBefore = (runtime.totalMemory() - runtime.freeMemory()) / mb;
- int numContainers = 100000;
- ApplicationId appId = ApplicationId.newInstance(0, 1);
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, 1);
- for (int i = 1; i <= numContainers; ++i) {
- ContainerId containerId = ContainerId.newInstance(appAttemptId, i);
- writeContainerStartData(containerId);
- writeContainerFinishData(containerId);
- }
- long usedMemoryAfter = (runtime.totalMemory() - runtime.freeMemory()) / mb;
- Assert.assertTrue((usedMemoryAfter - usedMemoryBefore) < 400);
- }
-
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebApp.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebApp.java
index 82c4276..5420dc2 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebApp.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebApp.java
@@ -20,7 +20,6 @@
import static org.apache.hadoop.yarn.webapp.Params.TITLE;
import static org.mockito.Mockito.mock;
-import org.junit.Assert;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
@@ -31,26 +30,34 @@
import org.apache.hadoop.yarn.server.api.ApplicationContext;
import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManager;
import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManagerImpl;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryStore;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryStoreTestUtils;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.MemoryApplicationHistoryStore;
+import org.apache.hadoop.yarn.server.applicationhistoryservice.TestApplicationHistoryManagerImpl;
+import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
+import org.apache.hadoop.yarn.server.timeline.TimelineDataManager;
+import org.apache.hadoop.yarn.server.timeline.TimelineStore;
+import org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager;
import org.apache.hadoop.yarn.util.StringHelper;
import org.apache.hadoop.yarn.webapp.YarnWebParams;
import org.apache.hadoop.yarn.webapp.test.WebAppTests;
-import org.junit.Before;
+import org.junit.Assert;
+import org.junit.BeforeClass;
import org.junit.Test;
import com.google.inject.Injector;
-public class TestAHSWebApp extends ApplicationHistoryStoreTestUtils {
+public class TestAHSWebApp {
- public void setApplicationHistoryStore(ApplicationHistoryStore store) {
- this.store = store;
- }
+ private static ApplicationHistoryManagerImpl historyManager;
- @Before
- public void setup() {
- store = new MemoryApplicationHistoryStore();
+ @BeforeClass
+ public static void setup() throws Exception {
+ Configuration conf = new YarnConfiguration();
+ TimelineStore store = TestApplicationHistoryManagerImpl.createStore(1);
+ TimelineACLsManager aclsManager = new TimelineACLsManager(conf);
+ TimelineDataManager dataManager =
+ new TimelineDataManager(store, aclsManager);
+ ApplicationACLsManager appAclsManager = new ApplicationACLsManager(conf);
+ historyManager = new ApplicationHistoryManagerImpl(dataManager, appAclsManager);
+ historyManager.init(conf);
}
@Test
@@ -67,9 +74,8 @@ public void testAppControllerIndex() throws Exception {
@Test
public void testView() throws Exception {
- Injector injector =
- WebAppTests.createMockInjector(ApplicationContext.class,
- mockApplicationHistoryManager(5, 1, 1));
+ Injector injector = WebAppTests.createMockInjector(
+ ApplicationContext.class, historyManager);
AHSView ahsViewInstance = injector.getInstance(AHSView.class);
ahsViewInstance.render();
@@ -88,9 +94,8 @@ public void testView() throws Exception {
@Test
public void testAppPage() throws Exception {
- Injector injector =
- WebAppTests.createMockInjector(ApplicationContext.class,
- mockApplicationHistoryManager(1, 5, 1));
+ Injector injector = WebAppTests.createMockInjector(
+ ApplicationContext.class, historyManager);
AppPage appPageInstance = injector.getInstance(AppPage.class);
appPageInstance.render();
@@ -104,9 +109,8 @@ public void testAppPage() throws Exception {
@Test
public void testAppAttemptPage() throws Exception {
- Injector injector =
- WebAppTests.createMockInjector(ApplicationContext.class,
- mockApplicationHistoryManager(1, 1, 5));
+ Injector injector = WebAppTests.createMockInjector(
+ ApplicationContext.class, historyManager);
AppAttemptPage appAttemptPageInstance =
injector.getInstance(AppAttemptPage.class);
@@ -122,9 +126,8 @@ public void testAppAttemptPage() throws Exception {
@Test
public void testContainerPage() throws Exception {
- Injector injector =
- WebAppTests.createMockInjector(ApplicationContext.class,
- mockApplicationHistoryManager(1, 1, 1));
+ Injector injector = WebAppTests.createMockInjector(
+ ApplicationContext.class, historyManager);
ContainerPage containerPageInstance =
injector.getInstance(ContainerPage.class);
@@ -141,42 +144,4 @@ public void testContainerPage() throws Exception {
WebAppTests.flushOutput(injector);
}
- ApplicationHistoryManager mockApplicationHistoryManager(int numApps,
- int numAppAttempts, int numContainers) throws Exception {
- ApplicationHistoryManager ahManager =
- new MockApplicationHistoryManagerImpl(store);
- for (int i = 1; i <= numApps; ++i) {
- ApplicationId appId = ApplicationId.newInstance(0, i);
- writeApplicationStartData(appId);
- for (int j = 1; j <= numAppAttempts; ++j) {
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, j);
- writeApplicationAttemptStartData(appAttemptId);
- for (int k = 1; k <= numContainers; ++k) {
- ContainerId containerId = ContainerId.newInstance(appAttemptId, k);
- writeContainerStartData(containerId);
- writeContainerFinishData(containerId);
- }
- writeApplicationAttemptFinishData(appAttemptId);
- }
- writeApplicationFinishData(appId);
- }
- return ahManager;
- }
-
- class MockApplicationHistoryManagerImpl extends ApplicationHistoryManagerImpl {
-
- public MockApplicationHistoryManagerImpl(ApplicationHistoryStore store) {
- super();
- init(new YarnConfiguration());
- start();
- }
-
- @Override
- protected ApplicationHistoryStore createApplicationHistoryStore(
- Configuration conf) {
- return store;
- }
- };
-
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
index b348443..fe1df0d 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java
@@ -23,8 +23,6 @@
import javax.ws.rs.core.MediaType;
-import org.junit.Assert;
-
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
@@ -32,14 +30,16 @@
import org.apache.hadoop.yarn.api.records.ContainerState;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.NodeId;
-import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.api.ApplicationContext;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManager;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryStore;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.MemoryApplicationHistoryStore;
+import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManagerImpl;
+import org.apache.hadoop.yarn.server.applicationhistoryservice.TestApplicationHistoryManagerImpl;
+import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
+import org.apache.hadoop.yarn.server.timeline.TimelineDataManager;
+import org.apache.hadoop.yarn.server.timeline.TimelineStore;
+import org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager;
import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
import org.apache.hadoop.yarn.webapp.WebServicesTestUtils;
import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
@@ -47,6 +47,7 @@
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import com.google.inject.Guice;
@@ -63,7 +64,20 @@
public class TestAHSWebServices extends JerseyTest {
- private static ApplicationHistoryManager ahManager;
+ private static ApplicationHistoryManagerImpl historyManager;
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ Configuration conf = new YarnConfiguration();
+ TimelineStore store = TestApplicationHistoryManagerImpl.createStore(5);
+ TimelineACLsManager aclsManager = new TimelineACLsManager(conf);
+ TimelineDataManager dataManager =
+ new TimelineDataManager(store, aclsManager);
+ ApplicationACLsManager appAclsManager = new ApplicationACLsManager(conf);
+ historyManager = new ApplicationHistoryManagerImpl(dataManager, appAclsManager);
+ historyManager.init(conf);
+ }
+
private Injector injector = Guice.createInjector(new ServletModule() {
@@ -72,12 +86,7 @@ protected void configureServlets() {
bind(JAXBContextResolver.class);
bind(AHSWebServices.class);
bind(GenericExceptionHandler.class);
- try {
- ahManager = mockApplicationHistoryManager();
- } catch (Exception e) {
- Assert.fail();
- }
- bind(ApplicationContext.class).toInstance(ahManager);
+ bind(ApplicationContext.class).toInstance(historyManager);
serve("/*").with(GuiceContainer.class);
}
});
@@ -90,16 +99,6 @@ protected Injector getInjector() {
}
}
- private ApplicationHistoryManager mockApplicationHistoryManager()
- throws Exception {
- ApplicationHistoryStore store = new MemoryApplicationHistoryStore();
- TestAHSWebApp testAHSWebApp = new TestAHSWebApp();
- testAHSWebApp.setApplicationHistoryStore(store);
- ApplicationHistoryManager ahManager =
- testAHSWebApp.mockApplicationHistoryManager(5, 5, 5);
- return ahManager;
- }
-
public TestAHSWebServices() {
super(new WebAppDescriptor.Builder(
"org.apache.hadoop.yarn.server.applicationhistoryservice.webapp")
@@ -194,11 +193,11 @@ public void testSingleApp() throws Exception {
assertEquals("incorrect number of elements", 1, json.length());
JSONObject app = json.getJSONObject("app");
assertEquals(appId.toString(), app.getString("appId"));
- assertEquals(appId.toString(), app.get("name"));
- assertEquals(appId.toString(), app.get("diagnosticsInfo"));
+ assertEquals("test app", app.get("name"));
+ assertEquals("test diagnostics info", app.get("diagnosticsInfo"));
assertEquals("test queue", app.get("queue"));
- assertEquals("test user", app.get("user"));
- assertEquals("test type", app.get("type"));
+ assertEquals("user1", app.get("user"));
+ assertEquals("test app type", app.get("type"));
assertEquals(FinalApplicationStatus.UNDEFINED.toString(),
app.get("finalAppStatus"));
assertEquals(YarnApplicationState.FINISHED.toString(), app.get("appState"));
@@ -237,9 +236,8 @@ public void testSingleAttempt() throws Exception {
assertEquals("incorrect number of elements", 1, json.length());
JSONObject appAttempt = json.getJSONObject("appAttempt");
assertEquals(appAttemptId.toString(), appAttempt.getString("appAttemptId"));
- assertEquals(appAttemptId.toString(), appAttempt.getString("host"));
- assertEquals(appAttemptId.toString(),
- appAttempt.getString("diagnosticsInfo"));
+ assertEquals("test host", appAttempt.getString("host"));
+ assertEquals("test diagnostics info", appAttempt.getString("diagnosticsInfo"));
assertEquals("test tracking url", appAttempt.getString("trackingUrl"));
assertEquals(YarnApplicationAttemptState.FINISHED.toString(),
appAttempt.get("appAttemptState"));
@@ -283,18 +281,17 @@ public void testSingleContainer() throws Exception {
assertEquals("incorrect number of elements", 1, json.length());
JSONObject container = json.getJSONObject("container");
assertEquals(containerId.toString(), container.getString("containerId"));
- assertEquals(containerId.toString(), container.getString("diagnosticsInfo"));
- assertEquals("0", container.getString("allocatedMB"));
- assertEquals("0", container.getString("allocatedVCores"));
- assertEquals(NodeId.newInstance("localhost", 0).toString(),
+ assertEquals("test diagnostics info", container.getString("diagnosticsInfo"));
+ assertEquals("-1", container.getString("allocatedMB"));
+ assertEquals("-1", container.getString("allocatedVCores"));
+ assertEquals(NodeId.newInstance("test host", -100).toString(),
container.getString("assignedNodeId"));
- assertEquals(Priority.newInstance(containerId.getId()).toString(),
- container.getString("priority"));
+ assertEquals("-1", container.getString("priority"));
Configuration conf = new YarnConfiguration();
assertEquals(WebAppUtils.getHttpSchemePrefix(conf) +
WebAppUtils.getAHSWebAppURLWithoutScheme(conf) +
- "/applicationhistory/logs/localhost:0/container_0_0001_01_000001/" +
- "container_0_0001_01_000001/test user",
+ "/applicationhistory/logs/test host:-100/container_0_0001_01_000001/" +
+ "container_0_0001_01_000001/user1",
container.getString("logUrl"));
assertEquals(ContainerState.COMPLETE.toString(),
container.getString("containerState"));
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContext.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContext.java
index 60f88f6..90d0d22 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContext.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContext.java
@@ -25,7 +25,6 @@
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.conf.ConfigurationProvider;
import org.apache.hadoop.yarn.event.Dispatcher;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
@@ -94,11 +93,6 @@
void setRMDelegationTokenSecretManager(
RMDelegationTokenSecretManager delegationTokenSecretManager);
- RMApplicationHistoryWriter getRMApplicationHistoryWriter();
-
- void setRMApplicationHistoryWriter(
- RMApplicationHistoryWriter rmApplicationHistoryWriter);
-
void setSystemMetricsPublisher(SystemMetricsPublisher systemMetricsPublisher);
SystemMetricsPublisher getSystemMetricsPublisher();
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java
index 36eec04..b18894b 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java
@@ -32,7 +32,6 @@
import org.apache.hadoop.yarn.conf.ConfigurationProvider;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.Dispatcher;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.NullRMStateStore;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore;
@@ -86,7 +85,6 @@
private NodesListManager nodesListManager;
private ResourceTrackerService resourceTrackerService;
private ApplicationMasterService applicationMasterService;
- private RMApplicationHistoryWriter rmApplicationHistoryWriter;
private SystemMetricsPublisher systemMetricsPublisher;
private ConfigurationProvider configurationProvider;
private long epoch;
@@ -116,8 +114,7 @@ public RMContextImpl(Dispatcher rmDispatcher,
AMRMTokenSecretManager appTokenSecretManager,
RMContainerTokenSecretManager containerTokenSecretManager,
NMTokenSecretManagerInRM nmTokenSecretManager,
- ClientToAMTokenSecretManagerInRM clientToAMTokenSecretManager,
- RMApplicationHistoryWriter rmApplicationHistoryWriter) {
+ ClientToAMTokenSecretManagerInRM clientToAMTokenSecretManager) {
this();
this.setDispatcher(rmDispatcher);
this.setContainerAllocationExpirer(containerAllocationExpirer);
@@ -128,7 +125,6 @@ public RMContextImpl(Dispatcher rmDispatcher,
this.setContainerTokenSecretManager(containerTokenSecretManager);
this.setNMTokenSecretManager(nmTokenSecretManager);
this.setClientToAMTokenSecretManager(clientToAMTokenSecretManager);
- this.setRMApplicationHistoryWriter(rmApplicationHistoryWriter);
RMStateStore nullStore = new NullRMStateStore();
nullStore.setRMDispatcher(rmDispatcher);
@@ -355,11 +351,6 @@ public boolean isWorkPreservingRecoveryEnabled() {
}
@Override
- public RMApplicationHistoryWriter getRMApplicationHistoryWriter() {
- return rmApplicationHistoryWriter;
- }
-
- @Override
public void setSystemMetricsPublisher(
SystemMetricsPublisher systemMetricsPublisher) {
this.systemMetricsPublisher = systemMetricsPublisher;
@@ -371,12 +362,6 @@ public SystemMetricsPublisher getSystemMetricsPublisher() {
}
@Override
- public void setRMApplicationHistoryWriter(
- RMApplicationHistoryWriter rmApplicationHistoryWriter) {
- this.rmApplicationHistoryWriter = rmApplicationHistoryWriter;
- }
-
- @Override
public ConfigurationProvider getConfigurationProvider() {
return this.configurationProvider;
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
index 79af7a6..485c65d 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
@@ -61,7 +61,6 @@
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType;
import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.ApplicationMasterLauncher;
import org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher;
@@ -303,10 +302,6 @@ protected RMAppManager createRMAppManager() {
this.applicationACLsManager, this.conf);
}
- protected RMApplicationHistoryWriter createRMApplicationHistoryWriter() {
- return new RMApplicationHistoryWriter();
- }
-
protected SystemMetricsPublisher createSystemMetricsPublisher() {
return new SystemMetricsPublisher();
}
@@ -409,11 +404,6 @@ protected void serviceInit(Configuration configuration) throws Exception {
rmContext.setDelegationTokenRenewer(delegationTokenRenewer);
}
- RMApplicationHistoryWriter rmApplicationHistoryWriter =
- createRMApplicationHistoryWriter();
- addService(rmApplicationHistoryWriter);
- rmContext.setRMApplicationHistoryWriter(rmApplicationHistoryWriter);
-
SystemMetricsPublisher systemMetricsPublisher = createSystemMetricsPublisher();
addService(systemMetricsPublisher);
rmContext.setSystemMetricsPublisher(systemMetricsPublisher);
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/RMApplicationHistoryWriter.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/RMApplicationHistoryWriter.java
deleted file mode 100644
index bd328ab..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/RMApplicationHistoryWriter.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.resourcemanager.ahs;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.classification.InterfaceAudience.Private;
-import org.apache.hadoop.classification.InterfaceStability.Unstable;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.CompositeService;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.event.AsyncDispatcher;
-import org.apache.hadoop.yarn.event.Dispatcher;
-import org.apache.hadoop.yarn.event.Event;
-import org.apache.hadoop.yarn.event.EventHandler;
-import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryStore;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryWriter;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.FileSystemApplicationHistoryStore;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.NullApplicationHistoryStore;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptFinishData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptStartData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationFinishData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationStartData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerFinishData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerStartData;
-import org.apache.hadoop.yarn.server.resourcemanager.RMServerUtils;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
-import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
-
-import com.google.common.annotations.VisibleForTesting;
-
-/**
- *
- * {@link ResourceManager} uses this class to write the information of
- * {@link RMApp}, {@link RMAppAttempt} and {@link RMContainer}. These APIs are
- * non-blocking, and just schedule a writing history event. An self-contained
- * dispatcher vector will handle the event in separate threads, and extract the
- * required fields that are going to be persisted. Then, the extracted
- * information will be persisted via the implementation of
- * {@link ApplicationHistoryStore}.
- *
- */
-@Private
-@Unstable
-public class RMApplicationHistoryWriter extends CompositeService {
-
- public static final Log LOG = LogFactory
- .getLog(RMApplicationHistoryWriter.class);
-
- private Dispatcher dispatcher;
- @VisibleForTesting
- ApplicationHistoryWriter writer;
- @VisibleForTesting
- boolean historyServiceEnabled;
-
- public RMApplicationHistoryWriter() {
- super(RMApplicationHistoryWriter.class.getName());
- }
-
- @Override
- protected synchronized void serviceInit(Configuration conf) throws Exception {
- historyServiceEnabled =
- conf.getBoolean(YarnConfiguration.APPLICATION_HISTORY_ENABLED,
- YarnConfiguration.DEFAULT_APPLICATION_HISTORY_ENABLED);
- if (conf.get(YarnConfiguration.APPLICATION_HISTORY_STORE) == null ||
- conf.get(YarnConfiguration.APPLICATION_HISTORY_STORE).length() == 0 ||
- conf.get(YarnConfiguration.APPLICATION_HISTORY_STORE).equals(
- NullApplicationHistoryStore.class.getName())) {
- historyServiceEnabled = false;
- }
-
- // Only create the services when the history service is enabled and not
- // using the null store, preventing wasting the system resources.
- if (historyServiceEnabled) {
- writer = createApplicationHistoryStore(conf);
- addIfService(writer);
-
- dispatcher = createDispatcher(conf);
- dispatcher.register(WritingHistoryEventType.class,
- new ForwardingEventHandler());
- addIfService(dispatcher);
- }
- super.serviceInit(conf);
- }
-
- protected Dispatcher createDispatcher(Configuration conf) {
- MultiThreadedDispatcher dispatcher =
- new MultiThreadedDispatcher(
- conf
- .getInt(
- YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE,
- YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
- dispatcher.setDrainEventsOnStop();
- return dispatcher;
- }
-
- protected ApplicationHistoryStore createApplicationHistoryStore(
- Configuration conf) {
- try {
- Class extends ApplicationHistoryStore> storeClass =
- conf.getClass(YarnConfiguration.APPLICATION_HISTORY_STORE,
- NullApplicationHistoryStore.class,
- ApplicationHistoryStore.class);
- return storeClass.newInstance();
- } catch (Exception e) {
- String msg =
- "Could not instantiate ApplicationHistoryWriter: "
- + conf.get(YarnConfiguration.APPLICATION_HISTORY_STORE,
- NullApplicationHistoryStore.class.getName());
- LOG.error(msg, e);
- throw new YarnRuntimeException(msg, e);
- }
- }
-
- protected void handleWritingApplicationHistoryEvent(
- WritingApplicationHistoryEvent event) {
- switch (event.getType()) {
- case APP_START:
- WritingApplicationStartEvent wasEvent =
- (WritingApplicationStartEvent) event;
- try {
- writer.applicationStarted(wasEvent.getApplicationStartData());
- LOG.info("Stored the start data of application "
- + wasEvent.getApplicationId());
- } catch (IOException e) {
- LOG.error("Error when storing the start data of application "
- + wasEvent.getApplicationId());
- }
- break;
- case APP_FINISH:
- WritingApplicationFinishEvent wafEvent =
- (WritingApplicationFinishEvent) event;
- try {
- writer.applicationFinished(wafEvent.getApplicationFinishData());
- LOG.info("Stored the finish data of application "
- + wafEvent.getApplicationId());
- } catch (IOException e) {
- LOG.error("Error when storing the finish data of application "
- + wafEvent.getApplicationId());
- }
- break;
- case APP_ATTEMPT_START:
- WritingApplicationAttemptStartEvent waasEvent =
- (WritingApplicationAttemptStartEvent) event;
- try {
- writer.applicationAttemptStarted(waasEvent
- .getApplicationAttemptStartData());
- LOG.info("Stored the start data of application attempt "
- + waasEvent.getApplicationAttemptId());
- } catch (IOException e) {
- LOG.error("Error when storing the start data of application attempt "
- + waasEvent.getApplicationAttemptId());
- }
- break;
- case APP_ATTEMPT_FINISH:
- WritingApplicationAttemptFinishEvent waafEvent =
- (WritingApplicationAttemptFinishEvent) event;
- try {
- writer.applicationAttemptFinished(waafEvent
- .getApplicationAttemptFinishData());
- LOG.info("Stored the finish data of application attempt "
- + waafEvent.getApplicationAttemptId());
- } catch (IOException e) {
- LOG
- .error("Error when storing the finish data of application attempt "
- + waafEvent.getApplicationAttemptId());
- }
- break;
- case CONTAINER_START:
- WritingContainerStartEvent wcsEvent =
- (WritingContainerStartEvent) event;
- try {
- writer.containerStarted(wcsEvent.getContainerStartData());
- LOG.info("Stored the start data of container "
- + wcsEvent.getContainerId());
- } catch (IOException e) {
- LOG.error("Error when storing the start data of container "
- + wcsEvent.getContainerId());
- }
- break;
- case CONTAINER_FINISH:
- WritingContainerFinishEvent wcfEvent =
- (WritingContainerFinishEvent) event;
- try {
- writer.containerFinished(wcfEvent.getContainerFinishData());
- LOG.info("Stored the finish data of container "
- + wcfEvent.getContainerId());
- } catch (IOException e) {
- LOG.error("Error when storing the finish data of container "
- + wcfEvent.getContainerId());
- }
- break;
- default:
- LOG.error("Unknown WritingApplicationHistoryEvent type: "
- + event.getType());
- }
- }
-
- @SuppressWarnings("unchecked")
- public void applicationStarted(RMApp app) {
- if (historyServiceEnabled) {
- dispatcher.getEventHandler().handle(
- new WritingApplicationStartEvent(app.getApplicationId(),
- ApplicationStartData.newInstance(app.getApplicationId(), app.getName(),
- app.getApplicationType(), app.getQueue(), app.getUser(),
- app.getSubmitTime(), app.getStartTime())));
- }
- }
-
- @SuppressWarnings("unchecked")
- public void applicationFinished(RMApp app, RMAppState finalState) {
- if (historyServiceEnabled) {
- dispatcher.getEventHandler().handle(
- new WritingApplicationFinishEvent(app.getApplicationId(),
- ApplicationFinishData.newInstance(app.getApplicationId(),
- app.getFinishTime(), app.getDiagnostics().toString(),
- app.getFinalApplicationStatus(),
- RMServerUtils.createApplicationState(finalState))));
- }
- }
-
- @SuppressWarnings("unchecked")
- public void applicationAttemptStarted(RMAppAttempt appAttempt) {
- if (historyServiceEnabled) {
- dispatcher.getEventHandler().handle(
- new WritingApplicationAttemptStartEvent(appAttempt.getAppAttemptId(),
- ApplicationAttemptStartData.newInstance(appAttempt.getAppAttemptId(),
- appAttempt.getHost(), appAttempt.getRpcPort(), appAttempt
- .getMasterContainer().getId())));
- }
- }
-
- @SuppressWarnings("unchecked")
- public void applicationAttemptFinished(RMAppAttempt appAttempt,
- RMAppAttemptState finalState) {
- if (historyServiceEnabled) {
- dispatcher.getEventHandler().handle(
- new WritingApplicationAttemptFinishEvent(appAttempt.getAppAttemptId(),
- ApplicationAttemptFinishData.newInstance(
- appAttempt.getAppAttemptId(), appAttempt.getDiagnostics()
- .toString(), appAttempt.getTrackingUrl(), appAttempt
- .getFinalApplicationStatus(),
- RMServerUtils.createApplicationAttemptState(finalState))));
- }
- }
-
- @SuppressWarnings("unchecked")
- public void containerStarted(RMContainer container) {
- if (historyServiceEnabled) {
- dispatcher.getEventHandler().handle(
- new WritingContainerStartEvent(container.getContainerId(),
- ContainerStartData.newInstance(container.getContainerId(),
- container.getAllocatedResource(), container.getAllocatedNode(),
- container.getAllocatedPriority(), container.getCreationTime())));
- }
- }
-
- @SuppressWarnings("unchecked")
- public void containerFinished(RMContainer container) {
- if (historyServiceEnabled) {
- dispatcher.getEventHandler().handle(
- new WritingContainerFinishEvent(container.getContainerId(),
- ContainerFinishData.newInstance(container.getContainerId(),
- container.getFinishTime(), container.getDiagnosticsInfo(),
- container.getContainerExitStatus(),
- container.getContainerState())));
- }
- }
-
- /**
- * EventHandler implementation which forward events to HistoryWriter Making
- * use of it, HistoryWriter can avoid to have a public handle method
- */
- private final class ForwardingEventHandler implements
- EventHandler {
-
- @Override
- public void handle(WritingApplicationHistoryEvent event) {
- handleWritingApplicationHistoryEvent(event);
- }
-
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected static class MultiThreadedDispatcher extends CompositeService
- implements Dispatcher {
-
- private List dispatchers =
- new ArrayList();
-
- public MultiThreadedDispatcher(int num) {
- super(MultiThreadedDispatcher.class.getName());
- for (int i = 0; i < num; ++i) {
- AsyncDispatcher dispatcher = createDispatcher();
- dispatchers.add(dispatcher);
- addIfService(dispatcher);
- }
- }
-
- @Override
- public EventHandler getEventHandler() {
- return new CompositEventHandler();
- }
-
- @Override
- public void register(Class extends Enum> eventType, EventHandler handler) {
- for (AsyncDispatcher dispatcher : dispatchers) {
- dispatcher.register(eventType, handler);
- }
- }
-
- public void setDrainEventsOnStop() {
- for (AsyncDispatcher dispatcher : dispatchers) {
- dispatcher.setDrainEventsOnStop();
- }
- }
-
- private class CompositEventHandler implements EventHandler {
-
- @Override
- public void handle(Event event) {
- // Use hashCode (of ApplicationId) to dispatch the event to the child
- // dispatcher, such that all the writing events of one application will
- // be handled by one thread, the scheduled order of the these events
- // will be preserved
- int index = (event.hashCode() & Integer.MAX_VALUE) % dispatchers.size();
- dispatchers.get(index).getEventHandler().handle(event);
- }
-
- }
-
- protected AsyncDispatcher createDispatcher() {
- return new AsyncDispatcher();
- }
-
- }
-
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationAttemptFinishEvent.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationAttemptFinishEvent.java
deleted file mode 100644
index 3f6a620..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationAttemptFinishEvent.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.resourcemanager.ahs;
-
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptFinishData;
-
-public class WritingApplicationAttemptFinishEvent extends
- WritingApplicationHistoryEvent {
-
- private ApplicationAttemptId appAttemptId;
- private ApplicationAttemptFinishData appAttemptFinish;
-
- public WritingApplicationAttemptFinishEvent(
- ApplicationAttemptId appAttemptId,
- ApplicationAttemptFinishData appAttemptFinish) {
- super(WritingHistoryEventType.APP_ATTEMPT_FINISH);
- this.appAttemptId = appAttemptId;
- this.appAttemptFinish = appAttemptFinish;
- }
-
- @Override
- public int hashCode() {
- return appAttemptId.getApplicationId().hashCode();
- }
-
- public ApplicationAttemptId getApplicationAttemptId() {
- return appAttemptId;
- }
-
- public ApplicationAttemptFinishData getApplicationAttemptFinishData() {
- return appAttemptFinish;
- }
-
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationAttemptStartEvent.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationAttemptStartEvent.java
deleted file mode 100644
index 7e092d3..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationAttemptStartEvent.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.resourcemanager.ahs;
-
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptStartData;
-
-public class WritingApplicationAttemptStartEvent extends
- WritingApplicationHistoryEvent {
-
- private ApplicationAttemptId appAttemptId;
- private ApplicationAttemptStartData appAttemptStart;
-
- public WritingApplicationAttemptStartEvent(ApplicationAttemptId appAttemptId,
- ApplicationAttemptStartData appAttemptStart) {
- super(WritingHistoryEventType.APP_ATTEMPT_START);
- this.appAttemptId = appAttemptId;
- this.appAttemptStart = appAttemptStart;
- }
-
- @Override
- public int hashCode() {
- return appAttemptId.getApplicationId().hashCode();
- }
-
- public ApplicationAttemptId getApplicationAttemptId() {
- return appAttemptId;
- }
-
- public ApplicationAttemptStartData getApplicationAttemptStartData() {
- return appAttemptStart;
- }
-
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationFinishEvent.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationFinishEvent.java
deleted file mode 100644
index 7a20214..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationFinishEvent.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.resourcemanager.ahs;
-
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationFinishData;
-
-public class WritingApplicationFinishEvent extends
- WritingApplicationHistoryEvent {
-
- private ApplicationId appId;
- private ApplicationFinishData appFinish;
-
- public WritingApplicationFinishEvent(ApplicationId appId,
- ApplicationFinishData appFinish) {
- super(WritingHistoryEventType.APP_FINISH);
- this.appId = appId;
- this.appFinish = appFinish;
- }
-
- @Override
- public int hashCode() {
- return appId.hashCode();
- }
-
- public ApplicationId getApplicationId() {
- return appId;
- }
-
- public ApplicationFinishData getApplicationFinishData() {
- return appFinish;
- }
-
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationHistoryEvent.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationHistoryEvent.java
deleted file mode 100644
index bc17edc..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationHistoryEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.resourcemanager.ahs;
-
-import org.apache.hadoop.yarn.event.AbstractEvent;
-
-public class WritingApplicationHistoryEvent extends
- AbstractEvent {
-
- public WritingApplicationHistoryEvent(WritingHistoryEventType type) {
- super(type);
- }
-
-}
\ No newline at end of file
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationStartEvent.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationStartEvent.java
deleted file mode 100644
index 1b5dc78..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingApplicationStartEvent.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.resourcemanager.ahs;
-
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationStartData;
-
-public class WritingApplicationStartEvent extends
- WritingApplicationHistoryEvent {
-
- private ApplicationId appId;
- private ApplicationStartData appStart;
-
- public WritingApplicationStartEvent(ApplicationId appId,
- ApplicationStartData appStart) {
- super(WritingHistoryEventType.APP_START);
- this.appId = appId;
- this.appStart = appStart;
- }
-
- @Override
- public int hashCode() {
- return appId.hashCode();
- }
-
- public ApplicationId getApplicationId() {
- return appId;
- }
-
- public ApplicationStartData getApplicationStartData() {
- return appStart;
- }
-
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingContainerFinishEvent.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingContainerFinishEvent.java
deleted file mode 100644
index 6b27166..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingContainerFinishEvent.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.resourcemanager.ahs;
-
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerFinishData;
-
-public class WritingContainerFinishEvent extends WritingApplicationHistoryEvent {
-
- private ContainerId containerId;
- private ContainerFinishData containerFinish;
-
- public WritingContainerFinishEvent(ContainerId containerId,
- ContainerFinishData containerFinish) {
- super(WritingHistoryEventType.CONTAINER_FINISH);
- this.containerId = containerId;
- this.containerFinish = containerFinish;
- }
-
- @Override
- public int hashCode() {
- return containerId.getApplicationAttemptId().getApplicationId().hashCode();
- }
-
- public ContainerId getContainerId() {
- return containerId;
- }
-
- public ContainerFinishData getContainerFinishData() {
- return containerFinish;
- }
-
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingContainerStartEvent.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingContainerStartEvent.java
deleted file mode 100644
index f6df669..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingContainerStartEvent.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.resourcemanager.ahs;
-
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerStartData;
-
-public class WritingContainerStartEvent extends WritingApplicationHistoryEvent {
-
- private ContainerId containerId;
- private ContainerStartData containerStart;
-
- public WritingContainerStartEvent(ContainerId containerId,
- ContainerStartData containerStart) {
- super(WritingHistoryEventType.CONTAINER_START);
- this.containerId = containerId;
- this.containerStart = containerStart;
- }
-
- @Override
- public int hashCode() {
- return containerId.getApplicationAttemptId().getApplicationId().hashCode();
- }
-
- public ContainerId getContainerId() {
- return containerId;
- }
-
- public ContainerStartData getContainerStartData() {
- return containerStart;
- }
-
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingHistoryEventType.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingHistoryEventType.java
deleted file mode 100644
index 2f05428..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/WritingHistoryEventType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.resourcemanager.ahs;
-
-public enum WritingHistoryEventType {
- APP_START, APP_FINISH, APP_ATTEMPT_START, APP_ATTEMPT_FINISH,
- CONTAINER_START, CONTAINER_FINISH
-}
\ No newline at end of file
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
index 0b8f321..06d1445 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
@@ -383,7 +383,6 @@ public RMAppImpl(ApplicationId applicationId, RMContext rmContext,
this.stateMachine = stateMachineFactory.make(this);
- rmContext.getRMApplicationHistoryWriter().applicationStarted(this);
rmContext.getSystemMetricsPublisher().appCreated(this, startTime);
}
@@ -1143,8 +1142,6 @@ public void transition(RMAppImpl app, RMAppEvent event) {
new RMAppManagerEvent(app.applicationId,
RMAppManagerEventType.APP_COMPLETED));
- app.rmContext.getRMApplicationHistoryWriter()
- .applicationFinished(app, finalState);
app.rmContext.getSystemMetricsPublisher()
.appFinished(app, finalState, app.finishTime);
};
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
index d75a871..37fb051 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
@@ -1241,8 +1241,6 @@ public void transition(RMAppAttemptImpl appAttempt,
appAttemptId, finalAttemptState, keepContainersAcrossAppAttempts));
appAttempt.removeCredentials(appAttempt);
- appAttempt.rmContext.getRMApplicationHistoryWriter()
- .applicationAttemptFinished(appAttempt, finalAttemptState);
appAttempt.rmContext.getSystemMetricsPublisher()
.appAttemptFinished(appAttempt, finalAttemptState,
appAttempt.rmContext.getRMApps().get(
@@ -1359,8 +1357,6 @@ public void transition(RMAppAttemptImpl appAttempt,
// as that would mean an extra state-store write. For now, we hope that in
// work-preserving restart, AMs are forced to reregister.
- appAttempt.rmContext.getRMApplicationHistoryWriter()
- .applicationAttemptStarted(appAttempt);
appAttempt.rmContext.getSystemMetricsPublisher()
.appAttemptRegistered(appAttempt, System.currentTimeMillis());
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/RMContainerImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/RMContainerImpl.java
index 479734a..272d7d9 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/RMContainerImpl.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/RMContainerImpl.java
@@ -41,7 +41,6 @@
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus;
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRunningOnNodeEvent;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAttemptContainerAllocatedEvent;
@@ -191,7 +190,6 @@ public RMContainerImpl(Container container,
this.readLock = lock.readLock();
this.writeLock = lock.writeLock();
- rmContext.getRMApplicationHistoryWriter().containerStarted(this);
rmContext.getSystemMetricsPublisher().containerCreated(
this, this.creationTime);
}
@@ -498,8 +496,6 @@ public void transition(RMContainerImpl container, RMContainerEvent event) {
container.appAttemptId, finishedEvent.getRemoteContainerStatus(),
container.getAllocatedNode()));
- container.rmContext.getRMApplicationHistoryWriter().containerFinished(
- container);
container.rmContext.getSystemMetricsPublisher().containerFinished(
container, container.finishTime);
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java
index 333d0cf..de29570 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java
@@ -53,7 +53,6 @@
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.MockRMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
@@ -112,10 +111,9 @@ public RMContext mockRMContext(int n, long time) {
rmDispatcher);
AMLivelinessMonitor amFinishingMonitor = new AMLivelinessMonitor(
rmDispatcher);
- RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
RMContext context = new RMContextImpl(rmDispatcher,
containerAllocationExpirer, amLivelinessMonitor, amFinishingMonitor,
- null, null, null, null, null, writer) {
+ null, null, null, null, null) {
@Override
public ConcurrentMap getRMApps() {
return map;
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java
index db867a9..a344ea2 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java
@@ -80,7 +80,6 @@
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport;
-import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport;
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId;
@@ -103,7 +102,6 @@
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.NullRMStateStore;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore;
@@ -1080,8 +1078,6 @@ private void mockRMContext(YarnScheduler yarnScheduler, RMContext rmContext)
.thenReturn(queInfo);
when(yarnScheduler.getQueueInfo(eq("nonexistentqueue"), anyBoolean(), anyBoolean()))
.thenThrow(new IOException("queue does not exist"));
- RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
- when(rmContext.getRMApplicationHistoryWriter()).thenReturn(writer);
SystemMetricsPublisher publisher = mock(SystemMetricsPublisher.class);
when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher);
ConcurrentHashMap apps = getRMApps(rmContext,
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java
index d877e25..136e95d 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java
@@ -105,7 +105,7 @@ public void setUp() throws Exception {
rmContext =
new RMContextImpl(rmDispatcher, null, null, null,
- mock(DelegationTokenRenewer.class), null, null, null, null, null);
+ mock(DelegationTokenRenewer.class), null, null, null, null);
NodesListManager nodesListManager = mock(NodesListManager.class);
HostsFileReader reader = mock(HostsFileReader.class);
when(nodesListManager.getHostsReader()).thenReturn(reader);
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java
deleted file mode 100644
index 78077d4..0000000
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/ahs/TestRMApplicationHistoryWriter.java
+++ /dev/null
@@ -1,554 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.yarn.server.resourcemanager.ahs;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
-import org.junit.Assert;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.ContainerState;
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.hadoop.yarn.api.records.NodeId;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.api.records.ResourceRequest;
-import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.event.AsyncDispatcher;
-import org.apache.hadoop.yarn.event.Dispatcher;
-import org.apache.hadoop.yarn.event.Event;
-import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatResponse;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryStore;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.MemoryApplicationHistoryStore;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptHistoryData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationHistoryData;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerHistoryData;
-import org.apache.hadoop.yarn.server.resourcemanager.MockAM;
-import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
-import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
-import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerConfiguration;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestRMApplicationHistoryWriter {
-
- private static int MAX_RETRIES = 10;
-
- private RMApplicationHistoryWriter writer;
- private ApplicationHistoryStore store;
- private List dispatchers =
- new ArrayList();
-
- @Before
- public void setup() {
- store = new MemoryApplicationHistoryStore();
- Configuration conf = new Configuration();
- conf.setBoolean(YarnConfiguration.APPLICATION_HISTORY_ENABLED, true);
- conf.setClass(YarnConfiguration.APPLICATION_HISTORY_STORE,
- MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
- writer = new RMApplicationHistoryWriter() {
-
- @Override
- protected ApplicationHistoryStore createApplicationHistoryStore(
- Configuration conf) {
- return store;
- }
-
- @Override
- protected Dispatcher createDispatcher(Configuration conf) {
- MultiThreadedDispatcher dispatcher =
- new MultiThreadedDispatcher(
- conf
- .getInt(
- YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE,
- YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
- dispatcher.setDrainEventsOnStop();
- return dispatcher;
- }
-
- class MultiThreadedDispatcher extends
- RMApplicationHistoryWriter.MultiThreadedDispatcher {
-
- public MultiThreadedDispatcher(int num) {
- super(num);
- }
-
- @Override
- protected AsyncDispatcher createDispatcher() {
- CounterDispatcher dispatcher = new CounterDispatcher();
- dispatchers.add(dispatcher);
- return dispatcher;
- }
-
- }
- };
- writer.init(conf);
- writer.start();
- }
-
- @After
- public void tearDown() {
- writer.stop();
- }
-
- private static RMApp createRMApp(ApplicationId appId) {
- RMApp app = mock(RMApp.class);
- when(app.getApplicationId()).thenReturn(appId);
- when(app.getName()).thenReturn("test app");
- when(app.getApplicationType()).thenReturn("test app type");
- when(app.getUser()).thenReturn("test user");
- when(app.getQueue()).thenReturn("test queue");
- when(app.getSubmitTime()).thenReturn(0L);
- when(app.getStartTime()).thenReturn(1L);
- when(app.getFinishTime()).thenReturn(2L);
- when(app.getDiagnostics()).thenReturn(
- new StringBuilder("test diagnostics info"));
- when(app.getFinalApplicationStatus()).thenReturn(
- FinalApplicationStatus.UNDEFINED);
- return app;
- }
-
- private static RMAppAttempt createRMAppAttempt(
- ApplicationAttemptId appAttemptId) {
- RMAppAttempt appAttempt = mock(RMAppAttempt.class);
- when(appAttempt.getAppAttemptId()).thenReturn(appAttemptId);
- when(appAttempt.getHost()).thenReturn("test host");
- when(appAttempt.getRpcPort()).thenReturn(-100);
- Container container = mock(Container.class);
- when(container.getId())
- .thenReturn(ContainerId.newInstance(appAttemptId, 1));
- when(appAttempt.getMasterContainer()).thenReturn(container);
- when(appAttempt.getDiagnostics()).thenReturn("test diagnostics info");
- when(appAttempt.getTrackingUrl()).thenReturn("test url");
- when(appAttempt.getFinalApplicationStatus()).thenReturn(
- FinalApplicationStatus.UNDEFINED);
- return appAttempt;
- }
-
- private static RMContainer createRMContainer(ContainerId containerId) {
- RMContainer container = mock(RMContainer.class);
- when(container.getContainerId()).thenReturn(containerId);
- when(container.getAllocatedNode()).thenReturn(
- NodeId.newInstance("test host", -100));
- when(container.getAllocatedResource()).thenReturn(
- Resource.newInstance(-1, -1));
- when(container.getAllocatedPriority()).thenReturn(Priority.UNDEFINED);
- when(container.getCreationTime()).thenReturn(0L);
- when(container.getFinishTime()).thenReturn(1L);
- when(container.getDiagnosticsInfo()).thenReturn("test diagnostics info");
- when(container.getLogURL()).thenReturn("test log url");
- when(container.getContainerExitStatus()).thenReturn(-1);
- when(container.getContainerState()).thenReturn(ContainerState.COMPLETE);
- return container;
- }
-
- @Test
- public void testDefaultStoreSetup() throws Exception {
- Configuration conf = new YarnConfiguration();
- conf.setBoolean(YarnConfiguration.APPLICATION_HISTORY_ENABLED, true);
- RMApplicationHistoryWriter writer = new RMApplicationHistoryWriter();
- writer.init(conf);
- writer.start();
- try {
- Assert.assertFalse(writer.historyServiceEnabled);
- Assert.assertNull(writer.writer);
- } finally {
- writer.stop();
- writer.close();
- }
- }
-
- @Test
- public void testWriteApplication() throws Exception {
- RMApp app = createRMApp(ApplicationId.newInstance(0, 1));
-
- writer.applicationStarted(app);
- ApplicationHistoryData appHD = null;
- for (int i = 0; i < MAX_RETRIES; ++i) {
- appHD = store.getApplication(ApplicationId.newInstance(0, 1));
- if (appHD != null) {
- break;
- } else {
- Thread.sleep(100);
- }
- }
- Assert.assertNotNull(appHD);
- Assert.assertEquals("test app", appHD.getApplicationName());
- Assert.assertEquals("test app type", appHD.getApplicationType());
- Assert.assertEquals("test user", appHD.getUser());
- Assert.assertEquals("test queue", appHD.getQueue());
- Assert.assertEquals(0L, appHD.getSubmitTime());
- Assert.assertEquals(1L, appHD.getStartTime());
-
- writer.applicationFinished(app, RMAppState.FINISHED);
- for (int i = 0; i < MAX_RETRIES; ++i) {
- appHD = store.getApplication(ApplicationId.newInstance(0, 1));
- if (appHD.getYarnApplicationState() != null) {
- break;
- } else {
- Thread.sleep(100);
- }
- }
- Assert.assertEquals(2L, appHD.getFinishTime());
- Assert.assertEquals("test diagnostics info", appHD.getDiagnosticsInfo());
- Assert.assertEquals(FinalApplicationStatus.UNDEFINED,
- appHD.getFinalApplicationStatus());
- Assert.assertEquals(YarnApplicationState.FINISHED,
- appHD.getYarnApplicationState());
- }
-
- @Test
- public void testWriteApplicationAttempt() throws Exception {
- RMAppAttempt appAttempt =
- createRMAppAttempt(ApplicationAttemptId.newInstance(
- ApplicationId.newInstance(0, 1), 1));
- writer.applicationAttemptStarted(appAttempt);
- ApplicationAttemptHistoryData appAttemptHD = null;
- for (int i = 0; i < MAX_RETRIES; ++i) {
- appAttemptHD =
- store.getApplicationAttempt(ApplicationAttemptId.newInstance(
- ApplicationId.newInstance(0, 1), 1));
- if (appAttemptHD != null) {
- break;
- } else {
- Thread.sleep(100);
- }
- }
- Assert.assertNotNull(appAttemptHD);
- Assert.assertEquals("test host", appAttemptHD.getHost());
- Assert.assertEquals(-100, appAttemptHD.getRPCPort());
- Assert.assertEquals(ContainerId.newInstance(
- ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1), 1),
- appAttemptHD.getMasterContainerId());
-
- writer.applicationAttemptFinished(appAttempt, RMAppAttemptState.FINISHED);
- for (int i = 0; i < MAX_RETRIES; ++i) {
- appAttemptHD =
- store.getApplicationAttempt(ApplicationAttemptId.newInstance(
- ApplicationId.newInstance(0, 1), 1));
- if (appAttemptHD.getYarnApplicationAttemptState() != null) {
- break;
- } else {
- Thread.sleep(100);
- }
- }
- Assert.assertEquals("test diagnostics info",
- appAttemptHD.getDiagnosticsInfo());
- Assert.assertEquals("test url", appAttemptHD.getTrackingURL());
- Assert.assertEquals(FinalApplicationStatus.UNDEFINED,
- appAttemptHD.getFinalApplicationStatus());
- Assert.assertEquals(YarnApplicationAttemptState.FINISHED,
- appAttemptHD.getYarnApplicationAttemptState());
- }
-
- @Test
- public void testWriteContainer() throws Exception {
- RMContainer container =
- createRMContainer(ContainerId.newInstance(
- ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1),
- 1));
- writer.containerStarted(container);
- ContainerHistoryData containerHD = null;
- for (int i = 0; i < MAX_RETRIES; ++i) {
- containerHD =
- store.getContainer(ContainerId.newInstance(ApplicationAttemptId
- .newInstance(ApplicationId.newInstance(0, 1), 1), 1));
- if (containerHD != null) {
- break;
- } else {
- Thread.sleep(100);
- }
- }
- Assert.assertNotNull(containerHD);
- Assert.assertEquals(NodeId.newInstance("test host", -100),
- containerHD.getAssignedNode());
- Assert.assertEquals(Resource.newInstance(-1, -1),
- containerHD.getAllocatedResource());
- Assert.assertEquals(Priority.UNDEFINED, containerHD.getPriority());
- Assert.assertEquals(0L, container.getCreationTime());
-
- writer.containerFinished(container);
- for (int i = 0; i < MAX_RETRIES; ++i) {
- containerHD =
- store.getContainer(ContainerId.newInstance(ApplicationAttemptId
- .newInstance(ApplicationId.newInstance(0, 1), 1), 1));
- if (containerHD.getContainerState() != null) {
- break;
- } else {
- Thread.sleep(100);
- }
- }
- Assert.assertEquals("test diagnostics info",
- containerHD.getDiagnosticsInfo());
- Assert.assertEquals(-1, containerHD.getContainerExitStatus());
- Assert.assertEquals(ContainerState.COMPLETE,
- containerHD.getContainerState());
- }
-
- @Test
- public void testParallelWrite() throws Exception {
- List appIds = new ArrayList();
- for (int i = 0; i < 10; ++i) {
- Random rand = new Random(i);
- ApplicationId appId = ApplicationId.newInstance(0, rand.nextInt());
- appIds.add(appId);
- RMApp app = createRMApp(appId);
- writer.applicationStarted(app);
- for (int j = 1; j <= 10; ++j) {
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, j);
- RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId);
- writer.applicationAttemptStarted(appAttempt);
- for (int k = 1; k <= 10; ++k) {
- ContainerId containerId = ContainerId.newInstance(appAttemptId, k);
- RMContainer container = createRMContainer(containerId);
- writer.containerStarted(container);
- writer.containerFinished(container);
- }
- writer.applicationAttemptFinished(
- appAttempt, RMAppAttemptState.FINISHED);
- }
- writer.applicationFinished(app, RMAppState.FINISHED);
- }
- for (int i = 0; i < MAX_RETRIES; ++i) {
- if (allEventsHandled(20 * 10 * 10 + 20 * 10 + 20)) {
- break;
- } else {
- Thread.sleep(500);
- }
- }
- Assert.assertTrue(allEventsHandled(20 * 10 * 10 + 20 * 10 + 20));
- // Validate all events of one application are handled by one dispatcher
- for (ApplicationId appId : appIds) {
- Assert.assertTrue(handledByOne(appId));
- }
- }
-
- private boolean allEventsHandled(int expected) {
- int actual = 0;
- for (CounterDispatcher dispatcher : dispatchers) {
- for (Integer count : dispatcher.counts.values()) {
- actual += count;
- }
- }
- return actual == expected;
- }
-
- @Test
- public void testRMWritingMassiveHistoryForFairSche() throws Exception {
- //test WritingMassiveHistory for Fair Scheduler.
- testRMWritingMassiveHistory(true);
- }
-
- @Test
- public void testRMWritingMassiveHistoryForCapacitySche() throws Exception {
- //test WritingMassiveHistory for Capacity Scheduler.
- testRMWritingMassiveHistory(false);
- }
-
- private void testRMWritingMassiveHistory(boolean isFS) throws Exception {
- // 1. Show RM can run with writing history data
- // 2. Test additional workload of processing history events
- YarnConfiguration conf = new YarnConfiguration();
- if (isFS) {
- conf.setBoolean(FairSchedulerConfiguration.ASSIGN_MULTIPLE, true);
- conf.set("yarn.resourcemanager.scheduler.class",
- FairScheduler.class.getName());
- } else {
- conf.set("yarn.resourcemanager.scheduler.class",
- CapacityScheduler.class.getName());
- }
- // don't process history events
- MockRM rm = new MockRM(conf) {
- @Override
- protected RMApplicationHistoryWriter createRMApplicationHistoryWriter() {
- return new RMApplicationHistoryWriter() {
- @Override
- public void applicationStarted(RMApp app) {
- }
-
- @Override
- public void applicationFinished(RMApp app, RMAppState finalState) {
- }
-
- @Override
- public void applicationAttemptStarted(RMAppAttempt appAttempt) {
- }
-
- @Override
- public void applicationAttemptFinished(
- RMAppAttempt appAttempt, RMAppAttemptState finalState) {
- }
-
- @Override
- public void containerStarted(RMContainer container) {
- }
-
- @Override
- public void containerFinished(RMContainer container) {
- }
- };
- }
- };
- long startTime1 = System.currentTimeMillis();
- testRMWritingMassiveHistory(rm);
- long finishTime1 = System.currentTimeMillis();
- long elapsedTime1 = finishTime1 - startTime1;
- rm = new MockRM(conf);
- long startTime2 = System.currentTimeMillis();
- testRMWritingMassiveHistory(rm);
- long finishTime2 = System.currentTimeMillis();
- long elapsedTime2 = finishTime2 - startTime2;
- // No more than 10% additional workload
- // Should be much less, but computation time is fluctuated
- Assert.assertTrue(elapsedTime2 - elapsedTime1 < elapsedTime1 / 10);
- }
-
- private void testRMWritingMassiveHistory(MockRM rm) throws Exception {
- rm.start();
- MockNM nm = rm.registerNode("127.0.0.1:1234", 1024 * 10100);
-
- RMApp app = rm.submitApp(1024);
- nm.nodeHeartbeat(true);
- RMAppAttempt attempt = app.getCurrentAppAttempt();
- MockAM am = rm.sendAMLaunched(attempt.getAppAttemptId());
- am.registerAppAttempt();
-
- int request = 10000;
- am.allocate("127.0.0.1", 1024, request, new ArrayList());
- nm.nodeHeartbeat(true);
- List allocated =
- am.allocate(new ArrayList(),
- new ArrayList()).getAllocatedContainers();
- int waitCount = 0;
- int allocatedSize = allocated.size();
- while (allocatedSize < request && waitCount++ < 200) {
- Thread.sleep(300);
- allocated =
- am.allocate(new ArrayList(),
- new ArrayList()).getAllocatedContainers();
- allocatedSize += allocated.size();
- nm.nodeHeartbeat(true);
- }
- Assert.assertEquals(request, allocatedSize);
-
- am.unregisterAppAttempt();
- am.waitForState(RMAppAttemptState.FINISHING);
- nm.nodeHeartbeat(am.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
- am.waitForState(RMAppAttemptState.FINISHED);
-
- NodeHeartbeatResponse resp = nm.nodeHeartbeat(true);
- List cleaned = resp.getContainersToCleanup();
- int cleanedSize = cleaned.size();
- waitCount = 0;
- while (cleanedSize < allocatedSize && waitCount++ < 200) {
- Thread.sleep(300);
- resp = nm.nodeHeartbeat(true);
- cleaned = resp.getContainersToCleanup();
- cleanedSize += cleaned.size();
- }
- Assert.assertEquals(allocatedSize, cleanedSize);
- rm.waitForState(app.getApplicationId(), RMAppState.FINISHED);
-
- rm.stop();
- }
-
- private boolean handledByOne(ApplicationId appId) {
- int count = 0;
- for (CounterDispatcher dispatcher : dispatchers) {
- if (dispatcher.counts.containsKey(appId)) {
- ++count;
- }
- }
- return count == 1;
- }
-
- private static class CounterDispatcher extends AsyncDispatcher {
-
- private Map counts =
- new HashMap();
-
- @SuppressWarnings("rawtypes")
- @Override
- protected void dispatch(Event event) {
- if (event instanceof WritingApplicationHistoryEvent) {
- WritingApplicationHistoryEvent ashEvent =
- (WritingApplicationHistoryEvent) event;
- switch (ashEvent.getType()) {
- case APP_START:
- incrementCounts(((WritingApplicationStartEvent) event)
- .getApplicationId());
- break;
- case APP_FINISH:
- incrementCounts(((WritingApplicationFinishEvent) event)
- .getApplicationId());
- break;
- case APP_ATTEMPT_START:
- incrementCounts(((WritingApplicationAttemptStartEvent) event)
- .getApplicationAttemptId().getApplicationId());
- break;
- case APP_ATTEMPT_FINISH:
- incrementCounts(((WritingApplicationAttemptFinishEvent) event)
- .getApplicationAttemptId().getApplicationId());
- break;
- case CONTAINER_START:
- incrementCounts(((WritingContainerStartEvent) event)
- .getContainerId().getApplicationAttemptId().getApplicationId());
- break;
- case CONTAINER_FINISH:
- incrementCounts(((WritingContainerFinishEvent) event)
- .getContainerId().getApplicationAttemptId().getApplicationId());
- break;
- }
- }
- super.dispatch(event);
- }
-
- private void incrementCounts(ApplicationId appId) {
- Integer val = counts.get(appId);
- if (val == null) {
- counts.put(appId, 1);
- } else {
- counts.put(appId, val + 1);
- }
- }
- }
-
-}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMExpiry.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMExpiry.java
index c837450..176cb7b 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMExpiry.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMExpiry.java
@@ -72,7 +72,7 @@ public void setUp() {
// Dispatcher that processes events inline
Dispatcher dispatcher = new InlineDispatcher();
RMContext context = new RMContextImpl(dispatcher, null,
- null, null, null, null, null, null, null, null);
+ null, null, null, null, null, null, null);
dispatcher.register(SchedulerEventType.class,
new InlineDispatcher.EmptyEventHandler());
dispatcher.register(RMNodeEventType.class,
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMReconnect.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMReconnect.java
index d16d551..8873e27 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMReconnect.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMReconnect.java
@@ -74,7 +74,7 @@ public void setUp() {
new TestRMNodeEventDispatcher());
RMContext context = new RMContextImpl(dispatcher, null,
- null, null, null, null, null, null, null, null);
+ null, null, null, null, null, null, null);
dispatcher.register(SchedulerEventType.class,
new InlineDispatcher.EmptyEventHandler());
dispatcher.register(RMNodeEventType.class,
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestRMNMRPCResponseId.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestRMNMRPCResponseId.java
index 4f94695..ddb7a90 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestRMNMRPCResponseId.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestRMNMRPCResponseId.java
@@ -71,7 +71,7 @@ public void handle(Event event) {
RMContext context =
new RMContextImpl(dispatcher, null, null, null, null,
null, new RMContainerTokenSecretManager(conf),
- new NMTokenSecretManagerInRM(conf), null, null);
+ new NMTokenSecretManagerInRM(conf), null);
dispatcher.register(RMNodeEventType.class,
new ResourceManager.NodeEventDispatcher(context));
NodesListManager nodesListManager = new NodesListManager(context);
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java
index 457f21e..eed4fbc 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java
@@ -54,7 +54,6 @@
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
import org.apache.hadoop.yarn.server.resourcemanager.RMServerUtils;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore.ApplicationState;
@@ -94,7 +93,6 @@
private static int appId = 1;
private DrainDispatcher rmDispatcher;
private RMStateStore store;
- private RMApplicationHistoryWriter writer;
private SystemMetricsPublisher publisher;
private YarnScheduler scheduler;
private TestSchedulerEventDispatcher schedulerDispatcher;
@@ -195,15 +193,13 @@ public void setUp() throws Exception {
AMLivelinessMonitor amLivelinessMonitor = mock(AMLivelinessMonitor.class);
AMLivelinessMonitor amFinishingMonitor = mock(AMLivelinessMonitor.class);
store = mock(RMStateStore.class);
- writer = mock(RMApplicationHistoryWriter.class);
RMContext realRMContext =
new RMContextImpl(rmDispatcher,
containerAllocationExpirer, amLivelinessMonitor, amFinishingMonitor,
null, new AMRMTokenSecretManager(conf, this.rmContext),
new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(),
- writer);
+ new ClientToAMTokenSecretManagerInRM());
((RMContextImpl)realRMContext).setStateStore(store);
publisher = mock(SystemMetricsPublisher.class);
((RMContextImpl)realRMContext).setSystemMetricsPublisher(publisher);
@@ -357,7 +353,6 @@ private void sendAttemptUpdateSavedEvent(RMApp application) {
protected RMApp testCreateAppNewSaving(
ApplicationSubmissionContext submissionContext) throws IOException {
RMApp application = createNewTestApp(submissionContext);
- verify(writer).applicationStarted(any(RMApp.class));
verify(publisher).appCreated(any(RMApp.class), anyLong());
// NEW => NEW_SAVING event RMAppEventType.START
RMAppEvent event =
@@ -481,7 +476,6 @@ public void testUnmanagedApp() throws IOException {
application.getDiagnostics().indexOf(diagMsg) != -1);
// reset the counter of Mockito.verify
- reset(writer);
reset(publisher);
// test app fails after 1 app attempt failure
@@ -968,9 +962,6 @@ public void testGetAppReport() {
private void verifyApplicationFinished(RMAppState state) {
ArgumentCaptor finalState =
ArgumentCaptor.forClass(RMAppState.class);
- verify(writer).applicationFinished(any(RMApp.class), finalState.capture());
- Assert.assertEquals(state, finalState.getValue());
- finalState = ArgumentCaptor.forClass(RMAppState.class);
verify(publisher).appFinished(any(RMApp.class), finalState.capture(),
anyLong());
Assert.assertEquals(state, finalState.getValue());
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java
index 15028f9..99644e8 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/TestRMAppAttemptTransitions.java
@@ -71,7 +71,6 @@
import org.apache.hadoop.yarn.server.resourcemanager.ApplicationMasterService;
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEvent;
import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType;
import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.ApplicationMasterLauncher;
@@ -142,7 +141,6 @@
private ApplicationMasterLauncher applicationMasterLauncher;
private AMLivelinessMonitor amLivelinessMonitor;
private AMLivelinessMonitor amFinishingMonitor;
- private RMApplicationHistoryWriter writer;
private SystemMetricsPublisher publisher;
private RMStateStore store;
@@ -243,7 +241,6 @@ public void setUp() throws Exception {
mock(ContainerAllocationExpirer.class);
amLivelinessMonitor = mock(AMLivelinessMonitor.class);
amFinishingMonitor = mock(AMLivelinessMonitor.class);
- writer = mock(RMApplicationHistoryWriter.class);
MasterKeyData masterKeyData = amRMTokenManager.createNewMasterKey();
when(amRMTokenManager.getMasterKey()).thenReturn(masterKeyData);
rmContext =
@@ -252,8 +249,7 @@ public void setUp() throws Exception {
null, amRMTokenManager,
new RMContainerTokenSecretManager(conf),
nmTokenManager,
- clientToAMTokenManager,
- writer);
+ clientToAMTokenManager);
store = mock(RMStateStore.class);
((RMContextImpl) rmContext).setStateStore(store);
@@ -1473,11 +1469,6 @@ private void verifyAMHostAndPortInvalidated() {
private void verifyApplicationAttemptFinished(RMAppAttemptState state) {
ArgumentCaptor finalState =
ArgumentCaptor.forClass(RMAppAttemptState.class);
- verify(writer).applicationAttemptFinished(
- any(RMAppAttempt.class), finalState.capture());
- Assert.assertEquals(state, finalState.getValue());
- finalState =
- ArgumentCaptor.forClass(RMAppAttemptState.class);
verify(publisher).appAttemptFinished(any(RMAppAttempt.class), finalState.capture(),
any(RMApp.class), anyLong());
Assert.assertEquals(state, finalState.getValue());
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/TestRMContainerImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/TestRMContainerImpl.java
index 553587e..08b69f0 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/TestRMContainerImpl.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/TestRMContainerImpl.java
@@ -51,7 +51,6 @@
import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptEvent;
@@ -99,12 +98,10 @@ public void testReleaseWhileRunning() {
when(rmApp.getRMAppAttempt((ApplicationAttemptId)Matchers.any())).thenReturn(null);
Mockito.doReturn(rmApp).when(rmApps).get((ApplicationId)Matchers.any());
- RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
SystemMetricsPublisher publisher = mock(SystemMetricsPublisher.class);
RMContext rmContext = mock(RMContext.class);
when(rmContext.getDispatcher()).thenReturn(drainDispatcher);
when(rmContext.getContainerAllocationExpirer()).thenReturn(expirer);
- when(rmContext.getRMApplicationHistoryWriter()).thenReturn(writer);
when(rmContext.getRMApps()).thenReturn(rmApps);
when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher);
RMContainer rmContainer = new RMContainerImpl(container, appAttemptId,
@@ -114,7 +111,6 @@ public void testReleaseWhileRunning() {
assertEquals(resource, rmContainer.getAllocatedResource());
assertEquals(nodeId, rmContainer.getAllocatedNode());
assertEquals(priority, rmContainer.getAllocatedPriority());
- verify(writer).containerStarted(any(RMContainer.class));
verify(publisher).containerCreated(any(RMContainer.class), anyLong());
rmContainer.handle(new RMContainerEvent(containerId,
@@ -147,7 +143,6 @@ public void testReleaseWhileRunning() {
assertEquals(ContainerExitStatus.ABORTED,
rmContainer.getContainerExitStatus());
assertEquals(ContainerState.COMPLETE, rmContainer.getContainerState());
- verify(writer).containerFinished(any(RMContainer.class));
verify(publisher).containerFinished(any(RMContainer.class), anyLong());
ArgumentCaptor captor = ArgumentCaptor
@@ -189,12 +184,10 @@ public void testExpireWhileRunning() {
Container container = BuilderUtils.newContainer(containerId, nodeId,
"host:3465", resource, priority, null);
- RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
SystemMetricsPublisher publisher = mock(SystemMetricsPublisher.class);
RMContext rmContext = mock(RMContext.class);
when(rmContext.getDispatcher()).thenReturn(drainDispatcher);
when(rmContext.getContainerAllocationExpirer()).thenReturn(expirer);
- when(rmContext.getRMApplicationHistoryWriter()).thenReturn(writer);
when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher);
RMContainer rmContainer = new RMContainerImpl(container, appAttemptId,
nodeId, "user", rmContext);
@@ -203,7 +196,6 @@ public void testExpireWhileRunning() {
assertEquals(resource, rmContainer.getAllocatedResource());
assertEquals(nodeId, rmContainer.getAllocatedNode());
assertEquals(priority, rmContainer.getAllocatedPriority());
- verify(writer).containerStarted(any(RMContainer.class));
verify(publisher).containerCreated(any(RMContainer.class), anyLong());
rmContainer.handle(new RMContainerEvent(containerId,
@@ -232,7 +224,6 @@ public void testExpireWhileRunning() {
containerStatus, RMContainerEventType.EXPIRE));
drainDispatcher.await();
assertEquals(RMContainerState.RUNNING, rmContainer.getState());
- verify(writer, never()).containerFinished(any(RMContainer.class));
verify(publisher, never()).containerFinished(any(RMContainer.class),
anyLong());
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java
index e029749..e024233 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java
@@ -392,7 +392,7 @@ public void testRefreshQueues() throws Exception {
RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null,
null, new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
setupQueueConfiguration(conf);
cs.setConf(new YarnConfiguration());
cs.setRMContext(resourceManager.getRMContext());
@@ -498,7 +498,7 @@ public void testParseQueue() throws IOException {
cs.reinitialize(conf, new RMContextImpl(null, null, null, null, null,
null, new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null));
+ new ClientToAMTokenSecretManagerInRM()));
}
@Test
@@ -514,7 +514,7 @@ public void testReconnectedNode() throws Exception {
cs.reinitialize(csConf, new RMContextImpl(null, null, null, null,
null, null, new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null));
+ new ClientToAMTokenSecretManagerInRM()));
RMNode n1 = MockNodes.newNodeInfo(0, MockNodes.newResource(4 * GB), 1);
RMNode n2 = MockNodes.newNodeInfo(0, MockNodes.newResource(2 * GB), 2);
@@ -545,7 +545,7 @@ public void testRefreshQueuesWithNewQueue() throws Exception {
cs.reinitialize(conf, new RMContextImpl(null, null, null, null, null,
null, new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null));
+ new ClientToAMTokenSecretManagerInRM()));
checkQueueCapacities(cs, A_CAPACITY, B_CAPACITY);
// Add a new queue b4
@@ -963,7 +963,7 @@ public void testNumClusterNodes() throws Exception {
RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null,
null, new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
cs.setRMContext(rmContext);
CapacitySchedulerConfiguration csConf =
new CapacitySchedulerConfiguration();
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestChildQueueOrder.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestChildQueueOrder.java
index 66ec0e6..324988e 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestChildQueueOrder.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestChildQueueOrder.java
@@ -42,7 +42,6 @@
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.DrainDispatcher;
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher;
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.ContainerAllocationExpirer;
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
@@ -249,12 +248,10 @@ public void testSortedQueues() throws Exception {
ContainerAllocationExpirer expirer =
mock(ContainerAllocationExpirer.class);
DrainDispatcher drainDispatcher = new DrainDispatcher();
- RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
SystemMetricsPublisher publisher = mock(SystemMetricsPublisher.class);
RMContext rmContext = mock(RMContext.class);
when(rmContext.getContainerAllocationExpirer()).thenReturn(expirer);
when(rmContext.getDispatcher()).thenReturn(drainDispatcher);
- when(rmContext.getRMApplicationHistoryWriter()).thenReturn(writer);
when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher);
ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId(
app_0.getApplicationId(), 1);
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueMappings.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueMappings.java
index f573f43..587890a4 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueMappings.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueMappings.java
@@ -82,7 +82,7 @@ public void testQueueMapping() throws Exception {
RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null,
null, new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
cs.setConf(conf);
cs.setRMContext(rmContext);
cs.init(conf);
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueParsing.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueParsing.java
index a3b990c..d5462a1 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueParsing.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueParsing.java
@@ -46,7 +46,7 @@ public void testQueueParsing() throws Exception {
RMContextImpl rmContext = new RMContextImpl(null, null,
null, null, null, null, new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
capacityScheduler.setConf(conf);
capacityScheduler.setRMContext(rmContext);
capacityScheduler.init(conf);
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestUtils.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestUtils.java
index 9cb902d..2b1c128 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestUtils.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestUtils.java
@@ -41,7 +41,6 @@
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher;
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.ContainerAllocationExpirer;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
@@ -86,13 +85,12 @@ public EventHandler getEventHandler() {
new ContainerAllocationExpirer(nullDispatcher);
Configuration conf = new Configuration();
- RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
RMContextImpl rmContext =
new RMContextImpl(nullDispatcher, cae, null, null, null,
new AMRMTokenSecretManager(conf, null),
new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), writer);
+ new ClientToAMTokenSecretManagerInRM());
rmContext.setSystemMetricsPublisher(mock(SystemMetricsPublisher.class));
return rmContext;
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/TestFifoScheduler.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/TestFifoScheduler.java
index b4c4c10..2794474 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/TestFifoScheduler.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/TestFifoScheduler.java
@@ -55,7 +55,6 @@
import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
import org.apache.hadoop.yarn.server.resourcemanager.Task;
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
import org.apache.hadoop.yarn.server.resourcemanager.metrics.SystemMetricsPublisher;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler;
@@ -143,9 +142,8 @@ public void testFifoSchedulerCapacityWhenNoNMs() {
@Test(timeout=5000)
public void testAppAttemptMetrics() throws Exception {
AsyncDispatcher dispatcher = new InlineDispatcher();
- RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
RMContext rmContext = new RMContextImpl(dispatcher, null,
- null, null, null, null, null, null, null, writer);
+ null, null, null, null, null, null, null);
((RMContextImpl) rmContext).setSystemMetricsPublisher(
mock(SystemMetricsPublisher.class));
@@ -188,9 +186,8 @@ public void testNodeLocalAssignment() throws Exception {
NMTokenSecretManagerInRM nmTokenSecretManager =
new NMTokenSecretManagerInRM(conf);
nmTokenSecretManager.rollMasterKey();
- RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
RMContext rmContext = new RMContextImpl(dispatcher, null, null, null, null,
- null, containerTokenSecretManager, nmTokenSecretManager, null, writer);
+ null, containerTokenSecretManager, nmTokenSecretManager, null);
((RMContextImpl) rmContext).setSystemMetricsPublisher(
mock(SystemMetricsPublisher.class));
@@ -259,9 +256,8 @@ public void testUpdateResourceOnNode() throws Exception {
NMTokenSecretManagerInRM nmTokenSecretManager =
new NMTokenSecretManagerInRM(conf);
nmTokenSecretManager.rollMasterKey();
- RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
RMContext rmContext = new RMContextImpl(dispatcher, null, null, null, null,
- null, containerTokenSecretManager, nmTokenSecretManager, null, writer);
+ null, containerTokenSecretManager, nmTokenSecretManager, null);
((RMContextImpl) rmContext).setSystemMetricsPublisher(
mock(SystemMetricsPublisher.class));
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java
index 0df7c0d..2202571 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java
@@ -163,7 +163,7 @@ public static RMContext mockRMContext(int numApps, int racks, int numNodes,
deactivatedNodesMap.put(node.getHostName(), node);
}
return new RMContextImpl(null, null, null, null,
- null, null, null, null, null, null) {
+ null, null, null, null, null) {
@Override
public ConcurrentMap getRMApps() {
return applicationsMaps;
@@ -206,7 +206,7 @@ public static CapacityScheduler mockCapacityScheduler() throws IOException {
cs.setRMContext(new RMContextImpl(null, null, null, null, null,
null, new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null));
+ new ClientToAMTokenSecretManagerInRM()));
cs.init(conf);
return cs;
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java
index f07cb8d..a4f3396 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java
@@ -150,7 +150,7 @@ public YarnApplicationState createApplicationState() {
}
return new RMContextImpl(null, null, null, null,
- null, null, null, null, null, null) {
+ null, null, null, null, null) {
@Override
public ConcurrentMap getRMApps() {
return applicationsMaps;
@@ -173,7 +173,7 @@ private static FairScheduler mockFairScheduler() throws IOException {
fs.setRMContext(new RMContextImpl(null, null, null, null, null,
null, new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null));
+ new ClientToAMTokenSecretManagerInRM()));
fs.init(conf);
return fs;
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
index b5b7a43..732ce3f 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java
@@ -55,8 +55,6 @@
import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerRequest;
import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerResponse;
import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryServer;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryStore;
-import org.apache.hadoop.yarn.server.applicationhistoryservice.MemoryApplicationHistoryStore;
import org.apache.hadoop.yarn.server.applicationhistoryservice.webapp.AHSWebApp;
import org.apache.hadoop.yarn.server.nodemanager.Context;
import org.apache.hadoop.yarn.server.nodemanager.NodeHealthCheckerService;
@@ -678,8 +676,6 @@ public ApplicationHistoryServerWrapper() {
protected synchronized void serviceInit(Configuration conf)
throws Exception {
appHistoryServer = new ApplicationHistoryServer();
- conf.setClass(YarnConfiguration.APPLICATION_HISTORY_STORE,
- MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE,
MemoryTimelineStore.class, TimelineStore.class);
appHistoryServer.init(conf);