Java Code Examples for org.apache.hadoop.yarn.server.federation.policies.manager.PriorityBroadcastPolicyManager

Following code examples demonstrate how to use org.apache.hadoop.yarn.server.federation.policies.manager.PriorityBroadcastPolicyManagerfrom hadoop. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.apache.hadoop.yarn.server.federation.policies.manager.PriorityBroadcastPolicyManagerand various code implementation of this class.


  public SubClusterPolicyConfiguration getPriorityPolicy(String queue)
      throws FederationPolicyInitializationException {

    PriorityBroadcastPolicyManager wfp = new PriorityBroadcastPolicyManager();

    Map<SubClusterIdInfo, Float> routerWeights = new HashMap<>();
    for (SubClusterId s : subClusterIds) {
      routerWeights.put(new SubClusterIdInfo(s), 0.9f / subClusterIds.size());

    SubClusterIdInfo favorite = new SubClusterIdInfo((subClusterIds.get(0)));
    routerWeights.put(favorite, (0.1f + 0.9f / subClusterIds.size()));

    WeightedPolicyInfo policyInfo = new WeightedPolicyInfo();

    SubClusterPolicyConfiguration fpc = wfp.serializeConf();

    return fpc;

Policy that allows operator to configure "weights" for routing. This picks a PriorityRouterPolicy fo

r the router and a BroadcastAMRMProxyPolicy for the amrmproxy as they are designed to work together.

Read More