java.lang.Object
org.apache.hadoop.yarn.server.globalpolicygenerator.GPGPolicyFacade

public class GPGPolicyFacade extends Object
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

    Constructors
    Constructor
    Description
    GPGPolicyFacade(org.apache.hadoop.yarn.server.federation.utils.FederationStateStoreFacade stateStore, org.apache.hadoop.conf.Configuration conf)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.hadoop.yarn.server.federation.policies.manager.FederationPolicyManager
    Provides a utility for the policy generator to read the policy manager from the FederationStateStore.
    void
    setPolicyManager(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.