Class GPGPolicyFacade
java.lang.Object
org.apache.hadoop.yarn.server.globalpolicygenerator.GPGPolicyFacade
A utility class for the GPG Policy Generator to read and write policies
into the FederationStateStore. Policy specific logic is abstracted away in
this class, so the PolicyGenerator can avoid dealing with policy
construction, reinitialization, and serialization.
There are only two exposed methods:
getPolicyManager(String)
Gets the PolicyManager via queue name. Null if there is no policy
configured for the specified queue. The PolicyManager can be used to
extract the FederationRouterPolicy and
FederationAMRMProxyPolicy, as well as any policy specific parameters
setPolicyManager(FederationPolicyManager)
Sets the PolicyManager. If the policy configuration is the same, no change
occurs. Otherwise, the internal cache is updated and the new configuration
is written into the FederationStateStore
This class assumes that the GPG is the only service
writing policies. Thus, the only FederationStateStore reads occur the first
time a queue policy is retrieved - after that, the GPG only writes to the
FederationStateStore.
The class uses a PolicyManager cache and a SubClusterPolicyConfiguration
cache. The primary use for these caches are to serve reads, and to
identify when the PolicyGenerator has actually changed the policy
so unnecessary FederationStateStore policy writes can be avoided.-
Constructor Summary
ConstructorsConstructorDescriptionGPGPolicyFacade(org.apache.hadoop.yarn.server.federation.utils.FederationStateStoreFacade stateStore, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.yarn.server.federation.policies.manager.FederationPolicyManagergetPolicyManager(String queueName) Provides a utility for the policy generator to read the policy manager from the FederationStateStore.voidsetPolicyManager(org.apache.hadoop.yarn.server.federation.policies.manager.FederationPolicyManager policyManager) Provides a utility for the policy generator to write a policy manager into the FederationStateStore.
-
Constructor Details
-
GPGPolicyFacade
public GPGPolicyFacade(org.apache.hadoop.yarn.server.federation.utils.FederationStateStoreFacade stateStore, org.apache.hadoop.conf.Configuration conf)
-
-
Method Details
-
getPolicyManager
public org.apache.hadoop.yarn.server.federation.policies.manager.FederationPolicyManager getPolicyManager(String queueName) throws org.apache.hadoop.yarn.exceptions.YarnException Provides a utility for the policy generator to read the policy manager from the FederationStateStore. Because the policy generator should be the only component updating the policy, this implementation does not use the reinitialization feature.- Parameters:
queueName- the name of the queue we want the policy manager for.- Returns:
- the policy manager responsible for the queue policy.
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- exceptions from yarn servers.
-
setPolicyManager
public void setPolicyManager(org.apache.hadoop.yarn.server.federation.policies.manager.FederationPolicyManager policyManager) throws org.apache.hadoop.yarn.exceptions.YarnException Provides a utility for the policy generator to write a policy manager into the FederationStateStore. The facade keeps a cache and will only write into the FederationStateStore if the policy configuration has changed.- Parameters:
policyManager- The policy manager we want to update into the state store. It contains policy information as well as the queue name we will update for.- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- exceptions from yarn servers.
-