diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/integration/RMRegistryOperationsService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/integration/RMRegistryOperationsService.java
index e11890f..aa8496f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/integration/RMRegistryOperationsService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/integration/RMRegistryOperationsService.java
@@ -87,42 +87,6 @@ public void setPurgeOnCompletionPolicy(PurgePolicy purgeOnCompletionPolicy) {
this.purgeOnCompletionPolicy = purgeOnCompletionPolicy;
}
- public void onApplicationAttemptRegistered(ApplicationAttemptId attemptId,
- String host, int rpcport, String trackingurl) throws IOException {
-
- }
-
- public void onApplicationLaunched(ApplicationId id) throws IOException {
-
- }
-
- /**
- * Actions to take as an AM registers itself with the RM.
- * @param attemptId attempt ID
- * @throws IOException problems
- */
- public void onApplicationMasterRegistered(ApplicationAttemptId attemptId) throws
- IOException {
- }
-
- /**
- * Actions to take when the AM container is completed
- * @param containerId container ID
- * @throws IOException problems
- */
- public void onAMContainerFinished(ContainerId containerId) throws
- IOException {
- LOG.info("AM Container {} finished, purging application attempt records",
- containerId);
-
- // remove all application attempt entries
- purgeAppAttemptRecords(containerId.getApplicationAttemptId());
-
- // also treat as a container finish to remove container
- // level records for the AM container
- onContainerFinished(containerId);
- }
-
/**
* remove all application attempt entries
* @param attemptId attempt ID
@@ -159,9 +123,6 @@ public void onApplicationCompleted(ApplicationId id)
PersistencePolicies.APPLICATION);
}
- public void onApplicationAttemptAdded(ApplicationAttemptId appAttemptId) {
- }
-
/**
* This is the event where the user is known, so the user directory
* can be created
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/services/RegistryAdminService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/services/RegistryAdminService.java
index 7a20c24..5af65f1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/services/RegistryAdminService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/server/services/RegistryAdminService.java
@@ -93,6 +93,19 @@
protected final ExecutorService executor;
/**
+ * Future of the root path creation operation schedule on
+ * service start()
+ */
+ private Future rootPathsFuture;
+
+ /**
+ * Flag set to true when registry setup is completed —that is, when the
+ * root directories have been created. If that operation fails, this
+ * flag will remain false.
+ */
+ private volatile boolean registrySetupCompleted;
+
+ /**
* Construct an instance of the service
* @param name service name
*/
@@ -179,8 +192,13 @@ protected ExecutorService getExecutor() {
return submit(new Callable() {
@Override
public Boolean call() throws Exception {
- return maybeCreate(path, CreateMode.PERSISTENT,
- acls, createParents);
+ try {
+ return maybeCreate(path, CreateMode.PERSISTENT,
+ acls, createParents);
+ } catch (IOException e) {
+ LOG.warn("Exception creating path {}: {}", path, e);
+ throw e;
+ }
}
});
}
@@ -188,7 +206,7 @@ public Boolean call() throws Exception {
/**
* Init operation sets up the system ACLs.
* @param conf configuration of the service
- * @throws Exception
+ * @throws Exception on a failure to initialize.
*/
@Override
protected void serviceInit(Configuration conf) throws Exception {
@@ -205,14 +223,65 @@ protected void serviceInit(Configuration conf) throws Exception {
/**
* Start the service, including creating base directories with permissions
- * @throws Exception
+ * @throws Exceptionn on a failure to start.
*/
@Override
protected void serviceStart() throws Exception {
super.serviceStart();
// create the root directories
+ rootPathsFuture = asyncCreateRootRegistryPaths();
+ }
+
+ /**
+ * Asynchronous operation to create the root directories
+ * @return the future which can be used to await the outcome of this
+ * operation
+ */
+ @VisibleForTesting
+ public Future asyncCreateRootRegistryPaths() {
+ return submit(new Callable() {
+ @Override
+ public Void call() throws Exception {
+ createRootRegistryPaths();
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Get the outcome of the asynchronous directory creation operation
+ * @return the blocking future. If the service has not started this will
+ * be null.
+ */
+ public Future getRootPathsFuture() {
+ return rootPathsFuture;
+ }
+
+ /**
+ * Query if the registry has been set up successfully. This will be false
+ * if the operation has not been started, is underway, or if it failed.
+ * @return the current setup completion flag.
+ */
+ public boolean isRegistrySetupCompleted() {
+ return registrySetupCompleted;
+ }
+
+ /**
+ * Create the initial registry paths
+ * @throws IOException any failure
+ */
+ private void createRootRegistryPaths() throws IOException {
+
try {
- createRootRegistryPaths();
+ List systemACLs = getRegistrySecurity().getSystemACLs();
+ LOG.info("System ACLs {}",
+ RegistrySecurity.aclsToString(systemACLs));
+ maybeCreate("", CreateMode.PERSISTENT, systemACLs, false);
+ maybeCreate(PATH_USERS, CreateMode.PERSISTENT,
+ systemACLs, false);
+ maybeCreate(PATH_SYSTEM_SERVICES,
+ CreateMode.PERSISTENT,
+ systemACLs, false);
} catch (NoPathPermissionsException e) {
String message = String.format(Locale.ENGLISH,
@@ -227,28 +296,9 @@ protected void serviceStart() throws Exception {
LOG.error(" Failure {}", e, e);
LOG.error(message);
- // TODO: this is something temporary to deal with the problem
- // that jenkins is failing this test
throw new NoPathPermissionsException(e.getPath().toString(), message, e);
}
- }
-
- /**
- * Create the initial registry paths
- * @throws IOException any failure
- */
- @VisibleForTesting
- public void createRootRegistryPaths() throws IOException {
-
- List systemACLs = getRegistrySecurity().getSystemACLs();
- LOG.info("System ACLs {}",
- RegistrySecurity.aclsToString(systemACLs));
- maybeCreate("", CreateMode.PERSISTENT, systemACLs, false);
- maybeCreate(PATH_USERS, CreateMode.PERSISTENT,
- systemACLs, false);
- maybeCreate(PATH_SYSTEM_SERVICES,
- CreateMode.PERSISTENT,
- systemACLs, false);
+ registrySetupCompleted = true;
}
/**
@@ -507,15 +557,24 @@ public AsyncPurge(String path,
this.purgePolicy = purgePolicy;
}
+ /**
+ * Execute a purge operation. Exceptions are caught, logged and rethrown.
+ * @return the number of records purged
+ */
@Override
public Integer call() throws Exception {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Executing {}", this);
+ try {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Executing {}", this);
+ }
+ return purge(path,
+ selector,
+ purgePolicy,
+ callback);
+ } catch (Exception e) {
+ LOG.warn("Exception in {}: {}", this, e, e);
+ throw e;
}
- return purge(path,
- selector,
- purgePolicy,
- callback);
}
@Override
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/AbstractRegistryTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/AbstractRegistryTest.java
index 5b34f60..c6d58df 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/AbstractRegistryTest.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/AbstractRegistryTest.java
@@ -30,6 +30,9 @@
import java.io.IOException;
import java.net.URISyntaxException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
/**
* Abstract registry tests .. inits the field {@link #registry}
@@ -45,13 +48,21 @@
protected RegistryOperations operations;
@Before
- public void setupRegistry() throws IOException {
+ public void setupRegistry() throws
+ IOException,
+ InterruptedException,
+ ExecutionException,
+ TimeoutException {
registry = new RMRegistryOperationsService("yarnRegistry");
operations = registry;
registry.init(createRegistryConfiguration());
registry.start();
- operations.delete("/", true);
- registry.createRootRegistryPaths();
+ // await root directory creation completion
+ registry.getRootPathsFuture().get(30, TimeUnit.SECONDS);
+ // then purge the paths to clean up any existing entries
+ registry.delete("/", true);
+ // and rebuild
+ registry.asyncCreateRootRegistryPaths().get(30, TimeUnit.SECONDS);
addToTeardown(registry);
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestSecureRMRegistryOperations.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestSecureRMRegistryOperations.java
index 41760d6..2ebcede 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestSecureRMRegistryOperations.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestSecureRMRegistryOperations.java
@@ -47,6 +47,7 @@
import java.io.IOException;
import java.security.PrivilegedExceptionAction;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import static org.apache.hadoop.registry.client.api.RegistryConstants.*;
@@ -103,6 +104,7 @@ public RMRegistryOperationsService run() throws Exception {
operations.init(secureConf);
LOG.info(operations.bindingDiagnosticDetails());
operations.start();
+ operations.getRootPathsFuture().get(30, TimeUnit.SECONDS);
return operations;
}
});
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml
index b9e10ee..2d1250a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/pom.xml
@@ -61,6 +61,11 @@
+ org.apache.hadoop
+ hadoop-yarn-registry
+
+
+
com.google.guava
guava
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMActiveServiceContext.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMActiveServiceContext.java
index caa0ff13..cdf21e0 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMActiveServiceContext.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMActiveServiceContext.java
@@ -35,6 +35,7 @@
import org.apache.hadoop.yarn.server.resourcemanager.placement.PlacementManager;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.NullRMStateStore;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore;
+import org.apache.hadoop.yarn.server.resourcemanager.registry.RMRegistryService;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystem;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
@@ -96,6 +97,7 @@
private RMTimelineCollectorManager timelineCollectorManager;
private RMNodeLabelsManager nodeLabelManager;
+ private RMRegistryService registry;
private RMDelegatedNodeLabelsUpdater rmDelegatedNodeLabelsUpdater;
private long epoch;
private Clock systemClock = SystemClock.getInstance();
@@ -120,7 +122,8 @@ public RMActiveServiceContext(Dispatcher rmDispatcher,
RMContainerTokenSecretManager containerTokenSecretManager,
NMTokenSecretManagerInRM nmTokenSecretManager,
ClientToAMTokenSecretManagerInRM clientToAMTokenSecretManager,
- ResourceScheduler scheduler) {
+ ResourceScheduler scheduler,
+ RMRegistryService registry) {
this();
this.setContainerAllocationExpirer(containerAllocationExpirer);
this.setAMLivelinessMonitor(amLivelinessMonitor);
@@ -467,4 +470,16 @@ public PlacementManager getQueuePlacementManager() {
public void setQueuePlacementManager(PlacementManager placementMgr) {
this.queuePlacementManager = placementMgr;
}
+
+ @Private
+ @Unstable
+ public RMRegistryService getRegistry() {
+ return registry;
+ }
+
+ @Private
+ @Unstable
+ public void setRegistry(RMRegistryService registry) {
+ this.registry = registry;
+ }
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContext.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContext.java
index 2ba445c..f99b9d5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContext.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContext.java
@@ -33,6 +33,7 @@
import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMDelegatedNodeLabelsUpdater;
import org.apache.hadoop.yarn.server.resourcemanager.placement.PlacementManager;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore;
+import org.apache.hadoop.yarn.server.resourcemanager.registry.RMRegistryService;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystem;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
@@ -139,6 +140,8 @@ void setRMDelegatedNodeLabelsUpdater(
boolean isSchedulerReadyForAllocatingContainers();
Configuration getYarnConfiguration();
+
+ RMRegistryService getRegistry();
PlacementManager getQueuePlacementManager();
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java
index 1e702de..4e5a334 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java
@@ -37,6 +37,7 @@
import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMDelegatedNodeLabelsUpdater;
import org.apache.hadoop.yarn.server.resourcemanager.placement.PlacementManager;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore;
+import org.apache.hadoop.yarn.server.resourcemanager.registry.RMRegistryService;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystem;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
@@ -97,7 +98,8 @@ public RMContextImpl(Dispatcher rmDispatcher,
RMContainerTokenSecretManager containerTokenSecretManager,
NMTokenSecretManagerInRM nmTokenSecretManager,
ClientToAMTokenSecretManagerInRM clientToAMTokenSecretManager,
- ResourceScheduler scheduler) {
+ ResourceScheduler scheduler,
+ RMRegistryService registry) {
this();
this.setDispatcher(rmDispatcher);
setActiveServiceContext(new RMActiveServiceContext(rmDispatcher,
@@ -105,7 +107,8 @@ public RMContextImpl(Dispatcher rmDispatcher,
delegationTokenRenewer, appTokenSecretManager,
containerTokenSecretManager, nmTokenSecretManager,
clientToAMTokenSecretManager,
- scheduler));
+ scheduler,
+ registry));
ConfigurationProvider provider = new LocalConfigurationProvider();
setConfigurationProvider(provider);
@@ -131,7 +134,7 @@ public RMContextImpl(Dispatcher rmDispatcher,
appTokenSecretManager,
containerTokenSecretManager,
nmTokenSecretManager,
- clientToAMTokenSecretManager, null);
+ clientToAMTokenSecretManager, null, null);
}
@Override
@@ -499,4 +502,12 @@ public void setContainerQueueLimitCalculator(
QueueLimitCalculator limitCalculator) {
this.queueLimitCalculator = limitCalculator;
}
+
+ public RMRegistryService getRegistry() {
+ return activeServiceContext.getRegistry();
+ }
+
+ void setRegistry(RMRegistryService registry) {
+ activeServiceContext.setRegistry(registry);
+ }
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
index bf72fc1..2b6d475 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java
@@ -71,6 +71,7 @@
import org.apache.hadoop.yarn.event.EventDispatcher;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
+import org.apache.hadoop.registry.client.api.RegistryConstants;
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;
@@ -87,6 +88,7 @@
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore.RMState;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStoreFactory;
import org.apache.hadoop.yarn.server.resourcemanager.recovery.Recoverable;
+import org.apache.hadoop.yarn.server.resourcemanager.registry.RMRegistryService;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.AbstractReservationSystem;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystem;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
@@ -691,6 +693,14 @@ protected void serviceInit(Configuration configuration) throws Exception {
new RMNMInfo(rmContext, scheduler);
+ boolean registryEnabled =
+ conf.getBoolean(RegistryConstants.KEY_REGISTRY_ENABLED,
+ RegistryConstants.DEFAULT_REGISTRY_ENABLED);
+ if (registryEnabled) {
+ RMRegistryService registry = new RMRegistryService(rmContext);
+ addService(registry);
+ rmContext.setRegistry(registry);
+ }
super.serviceInit(conf);
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/registry/RMRegistryService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/registry/RMRegistryService.java
new file mode 100644
index 0000000..3926a1c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/registry/RMRegistryService.java
@@ -0,0 +1,239 @@
+/*
+ * 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.registry;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.registry.server.integration.RMRegistryOperationsService;
+import org.apache.hadoop.service.CompositeService;
+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.event.EventHandler;
+import org.apache.hadoop.yarn.server.resourcemanager.RMAppManagerEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.RMAppManagerEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStoreAppEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStoreEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStoreEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.recovery.records.ApplicationStateData;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAttemptContainerFinishedEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerEventType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+/**
+ * This is the RM service which translates from RM events
+ * to registry actions
+ */
+@InterfaceAudience.Private
+@InterfaceStability.Evolving
+public class RMRegistryService extends CompositeService {
+ private static final Logger LOG =
+ LoggerFactory.getLogger(RMRegistryService.class);
+
+ private final RMContext rmContext;
+
+ /**
+ * Registry service
+ */
+ private final RMRegistryOperationsService registryOperations;
+
+ public RMRegistryService(RMContext rmContext) {
+ super(RMRegistryService.class.getName());
+ this.rmContext = rmContext;
+
+ registryOperations =
+ new RMRegistryOperationsService("Registry");
+ addService(registryOperations);
+ }
+
+
+ @Override
+ protected void serviceStart() throws Exception {
+ super.serviceStart();
+
+ LOG.info("RM registry service started : {}",
+ registryOperations.bindingDiagnosticDetails());
+ // Register self as event handler for RM Events
+ register(RMAppAttemptEventType.class, new AppEventHandler());
+ register(RMAppManagerEventType.class, new AppManagerEventHandler());
+ register(RMStateStoreEventType.class, new StateStoreEventHandler());
+ register(RMContainerEventType.class, new ContainerEventHandler());
+ }
+
+ /**
+ * register a handler
+ * @param eventType event type
+ * @param handler handler
+ */
+ private void register(Class extends Enum> eventType,
+ EventHandler handler) {
+ rmContext.getDispatcher().register(eventType, handler);
+ }
+
+ @SuppressWarnings(
+ {"EnumSwitchStatementWhichMissesCases", "UnnecessaryDefault"})
+ protected void handleAppManagerEvent(RMAppManagerEvent event) throws
+ IOException {
+ RMAppManagerEventType eventType = event.getType();
+ ApplicationId appId =
+ event.getApplicationId();
+ switch (eventType) {
+ case APP_COMPLETED:
+ registryOperations.onApplicationCompleted(appId);
+ break;
+ default:
+ // this isn't in the enum today...just making sure for the
+ // future
+ break;
+ }
+ }
+
+ @SuppressWarnings("EnumSwitchStatementWhichMissesCases")
+ private void handleStateStoreEvent(RMStateStoreEvent event)
+ throws IOException {
+ RMStateStoreEventType eventType = event.getType();
+ switch (eventType) {
+ case STORE_APP:
+ RMStateStoreAppEvent storeAppEvent = (RMStateStoreAppEvent) event;
+ ApplicationStateData appState = storeAppEvent.getAppState();
+ ApplicationId appId =
+ appState.getApplicationSubmissionContext().getApplicationId();
+ registryOperations.onStateStoreEvent(appId, appState.getUser());
+ break;
+
+ default:
+ break;
+ }
+ }
+
+
+ @SuppressWarnings("EnumSwitchStatementWhichMissesCases")
+ protected void handleAppAttemptEvent(RMAppAttemptEvent event) throws
+ IOException {
+ RMAppAttemptEventType eventType = event.getType();
+ ApplicationAttemptId appAttemptId =
+ event.getApplicationAttemptId();
+
+ switch (eventType) {
+
+ case UNREGISTERED:
+ registryOperations.onApplicationAttemptUnregistered(appAttemptId);
+ break;
+
+ // container has finished
+ case CONTAINER_FINISHED:
+ RMAppAttemptContainerFinishedEvent cfe =
+ (RMAppAttemptContainerFinishedEvent) event;
+ ContainerId containerId = cfe.getContainerStatus().getContainerId();
+ registryOperations.onContainerFinished(containerId);
+ break;
+
+ default:
+ // do nothing
+ }
+ }
+
+ @SuppressWarnings("EnumSwitchStatementWhichMissesCases")
+ private void handleContainerEvent(RMContainerEvent event)
+ throws IOException {
+ RMContainerEventType eventType = event.getType();
+ switch (eventType) {
+ case FINISHED:
+ ContainerId containerId = event.getContainerId();
+ registryOperations.onContainerFinished(containerId);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Handler for app events
+ */
+ private class AppEventHandler implements
+ EventHandler {
+
+ @Override
+ public void handle(RMAppAttemptEvent event) {
+ try {
+ handleAppAttemptEvent(event);
+ } catch (IOException e) {
+ LOG.warn("handling {}: {}", event, e, e);
+ }
+ }
+ }
+
+ /**
+ * Handler for RM-side App manager events
+ */
+
+ private class AppManagerEventHandler
+ implements EventHandler {
+ @Override
+ public void handle(RMAppManagerEvent event) {
+ try {
+ handleAppManagerEvent(event);
+ } catch (IOException e) {
+ LOG.warn("handling {}: {}", event, e, e);
+ }
+ }
+ }
+
+ /**
+ * Handler for RM-side state store events.
+ * This happens early on, and as the data contains the user details,
+ * it is where paths can be set up in advance of being used.
+ */
+
+ private class StateStoreEventHandler implements EventHandler {
+ @Override
+ public void handle(RMStateStoreEvent event) {
+ try {
+ handleStateStoreEvent(event);
+ } catch (IOException e) {
+ LOG.warn("handling {}: {}", event, e, e);
+ }
+ }
+ }
+
+ /**
+ * Handler for RM-side container events
+ */
+ private class ContainerEventHandler implements EventHandler {
+
+ @Override
+ public void handle(RMContainerEvent event) {
+ try {
+ handleContainerEvent(event);
+ } catch (IOException e) {
+ LOG.warn("handling {}: {}", event, e, e);
+ }
+ }
+ }
+
+
+}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java
index 6038b31..a91e564 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMNodeTransitions.java
@@ -115,7 +115,7 @@ public void setUp() throws Exception {
rmContext =
new RMContextImpl(rmDispatcher, mock(ContainerAllocationExpirer.class),
null, null, mock(DelegationTokenRenewer.class), null, null, null,
- null, null);
+ null);
NodesListManager nodesListManager = mock(NodesListManager.class);
HostsFileReader reader = mock(HostsFileReader.class);
when(nodesListManager.getHostsReader()).thenReturn(reader);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/ReservationSystemTestUtil.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/ReservationSystemTestUtil.java
index 24c386a..90a4770 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/ReservationSystemTestUtil.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/ReservationSystemTestUtil.java
@@ -257,7 +257,7 @@ public static RMContext createRMContext(Configuration conf) {
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null));
+ new ClientToAMTokenSecretManagerInRM()));
RMNodeLabelsManager nlm = mock(RMNodeLabelsManager.class);
when(nlm.getQueueResource(any(String.class), anySetOf(String.class),
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMExpiry.java b/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
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMExpiry.java
+++ b/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 a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMReconnect.java b/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 e7c7e51..a28b6ec 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMReconnect.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestNMReconnect.java
@@ -93,7 +93,7 @@ public void setUp() {
new TestRMNodeEventDispatcher());
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 a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestRMNMRPCResponseId.java b/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..f2b75a1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/TestRMNMRPCResponseId.java
+++ b/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);
@@ -137,4 +137,4 @@ public void testRPCResponseId() throws IOException, YarnException {
Assert.assertEquals("Too far behind rm response id:2 nm response id:0",
response.getDiagnosticsMessage());
}
-}
\ No newline at end of file
+}
diff --git a/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 b/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 bc92c01..3b9c2b8 100644
--- a/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
+++ b/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
@@ -485,7 +485,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());
@@ -594,7 +594,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
@@ -610,7 +610,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);
@@ -641,7 +641,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
@@ -2315,7 +2315,7 @@ public void testPreemptionDisabled() 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());
diff --git a/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 b/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 92baa85..38cc7ad 100644
--- a/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
+++ b/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
@@ -431,7 +431,7 @@ public void testQueueParsingReinitializeWithLabels() throws IOException {
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
rmContext.setNodeLabelManager(nodeLabelManager);
capacityScheduler.setConf(conf);
capacityScheduler.setRMContext(rmContext);
@@ -520,7 +520,7 @@ public void testQueueParsingWithLabels() throws IOException {
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
rmContext.setNodeLabelManager(nodeLabelManager);
capacityScheduler.setConf(csConf);
capacityScheduler.setRMContext(rmContext);
@@ -544,7 +544,7 @@ public void testQueueParsingWithLabelsInherit() throws IOException {
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
rmContext.setNodeLabelManager(nodeLabelManager);
capacityScheduler.setConf(csConf);
capacityScheduler.setRMContext(rmContext);
@@ -567,7 +567,7 @@ public void testQueueParsingWhenLabelsNotExistedInNodeLabelManager()
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
RMNodeLabelsManager nodeLabelsManager = new NullRMNodeLabelsManager();
nodeLabelsManager.init(conf);
@@ -595,7 +595,7 @@ public void testQueueParsingWhenLabelsInheritedNotExistedInNodeLabelManager()
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
RMNodeLabelsManager nodeLabelsManager = new NullRMNodeLabelsManager();
nodeLabelsManager.init(conf);
@@ -623,7 +623,7 @@ public void testSingleLevelQueueParsingWhenLabelsNotExistedInNodeLabelManager()
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
RMNodeLabelsManager nodeLabelsManager = new NullRMNodeLabelsManager();
nodeLabelsManager.init(conf);
@@ -650,7 +650,7 @@ public void testQueueParsingWhenLabelsNotExist() throws IOException {
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
RMNodeLabelsManager nodeLabelsManager = new NullRMNodeLabelsManager();
nodeLabelsManager.init(conf);
@@ -685,7 +685,7 @@ public void testQueueParsingWithUnusedLabels() throws IOException {
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
rmContext.setNodeLabelManager(nodeLabelManager);
capacityScheduler.setRMContext(rmContext);
capacityScheduler.init(conf);
@@ -794,7 +794,7 @@ public void testQueueParsingFailWhenSumOfChildrenNonLabeledCapacityNot100Percent
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
rmContext.setNodeLabelManager(nodeLabelManager);
capacityScheduler.setConf(csConf);
capacityScheduler.setRMContext(rmContext);
@@ -825,7 +825,7 @@ public void testQueueParsingFailWhenSumOfChildrenLabeledCapacityNot100Percent()
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
rmContext.setNodeLabelManager(nodeLabelManager);
capacityScheduler.setConf(csConf);
capacityScheduler.setRMContext(rmContext);
@@ -860,7 +860,7 @@ public void testQueueParsingWithSumOfChildLabelCapacityNot100PercentWithWildCard
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
rmContext.setNodeLabelManager(nodeLabelManager);
capacityScheduler.setConf(csConf);
capacityScheduler.setRMContext(rmContext);
@@ -886,7 +886,7 @@ public void testQueueParsingWithMoveQueue()
new RMContextImpl(null, null, null, null, null, null,
new RMContainerTokenSecretManager(csConf),
new NMTokenSecretManagerInRM(csConf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
rmContext.setNodeLabelManager(nodeLabelManager);
capacityScheduler.setConf(csConf);
capacityScheduler.setRMContext(rmContext);
diff --git a/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 b/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 84217c4..14da820 100644
--- a/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
+++ b/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
@@ -182,7 +182,7 @@ public void testAppAttemptMetrics() throws Exception {
FifoScheduler scheduler = new FifoScheduler();
RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
RMContext rmContext = new RMContextImpl(dispatcher, null,
- null, null, null, null, null, null, null, scheduler);
+ null, null, null, null, null, null, null, scheduler, null);
((RMContextImpl) rmContext).setSystemMetricsPublisher(
mock(SystemMetricsPublisher.class));
@@ -229,7 +229,8 @@ public void testNodeLocalAssignment() throws Exception {
FifoScheduler scheduler = new FifoScheduler();
RMContext rmContext = new RMContextImpl(dispatcher, null, null, null, null,
- null, containerTokenSecretManager, nmTokenSecretManager, null, scheduler);
+ null, containerTokenSecretManager, nmTokenSecretManager, null,
+ scheduler, null);
rmContext.setSystemMetricsPublisher(mock(SystemMetricsPublisher.class));
rmContext.setRMApplicationHistoryWriter(
mock(RMApplicationHistoryWriter.class));
@@ -306,7 +307,8 @@ public void testUpdateResourceOnNode() throws Exception {
FifoScheduler scheduler = new FifoScheduler();
RMContext rmContext = new RMContextImpl(dispatcher, null, null, null, null,
- null, containerTokenSecretManager, nmTokenSecretManager, null, scheduler);
+ null, containerTokenSecretManager, nmTokenSecretManager, null,
+ scheduler, null);
rmContext.setSystemMetricsPublisher(mock(SystemMetricsPublisher.class));
rmContext.setRMApplicationHistoryWriter(mock(RMApplicationHistoryWriter.class));
((RMContextImpl) rmContext).setYarnConfiguration(new YarnConfiguration());
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java b/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 edf3b3f..8e63a0e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java
@@ -185,7 +185,7 @@ public static RMContext mockRMContext(int numApps, int racks, int numNodes,
}
RMContextImpl rmContext = new RMContextImpl(null, null, null, null,
- null, null, null, null, null, null) {
+ null, null, null, null, null, null, null) {
@Override
public ConcurrentMap getRMApps() {
return applicationsMaps;
@@ -232,7 +232,7 @@ public static CapacityScheduler mockCapacityScheduler() throws IOException {
RMContext rmContext = new RMContextImpl(null, null, null, null, null,
null, new RMContainerTokenSecretManager(conf),
new NMTokenSecretManagerInRM(conf),
- new ClientToAMTokenSecretManagerInRM(), null);
+ new ClientToAMTokenSecretManagerInRM());
rmContext.setNodeLabelManager(new NullRMNodeLabelsManager());
cs.setRMContext(rmContext);
cs.init(conf);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java b/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 06fa0d4..43e90a2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java
@@ -156,7 +156,7 @@ public YarnApplicationState createApplicationState() {
}
RMContextImpl rmContext = new RMContextImpl(null, null, null, null,
- null, null, null, null, null, null) {
+ null, null, null, null, null) {
@Override
public ConcurrentMap getRMApps() {
return applicationsMaps;
@@ -186,7 +186,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 a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServices.java
index 082d043..98c0d06 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServices.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServices.java
@@ -635,7 +635,7 @@ public void testAppsRace() throws Exception {
anyBoolean())).thenReturn(mockAppsResponse);
ResourceManager mockRM = mock(ResourceManager.class);
RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null,
- null, null, null, null, null);
+ null, null, null, null);
when(mockRM.getRMContext()).thenReturn(rmContext);
when(mockRM.getClientRMService()).thenReturn(mockClientSvc);
rmContext.setNodeLabelManager(mock(RMNodeLabelsManager.class));