org.apache.hadoop.yarn.server.federation.store.impl

## Class ZookeeperFederationStateStore

- java.lang.Object
- - org.apache.hadoop.yarn.server.federation.store.impl.ZookeeperFederationStateStore

- All Implemented Interfaces:
    FederationApplicationHomeSubClusterStore, FederationMembershipStateStore, FederationPolicyStore, FederationStateStore

      public class ZookeeperFederationStateStore
      extends Object
      implements FederationStateStore

  ZooKeeper implementation of `FederationStateStore`. The znode structure is as follows: ROOT_DIR_PATH |--- MEMBERSHIP | |----- SC1 | |----- SC2 |--- APPLICATION | |----- APP1 | |----- APP2 |--- POLICY |----- QUEUE1 |----- QUEUE1

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ZookeeperFederationStateStore()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AddApplicationHomeSubClusterResponse` | `addApplicationHomeSubCluster(AddApplicationHomeSubClusterRequest request)` Register the home `SubClusterId` of the newly submitted `ApplicationId`.
    `void` | `close()` Perform any cleanup operations of the StateStore.
    `DeleteApplicationHomeSubClusterResponse` | `deleteApplicationHomeSubCluster(DeleteApplicationHomeSubClusterRequest request)` Delete the mapping of home `SubClusterId` of a previously submitted `ApplicationId`.
    `SubClusterDeregisterResponse` | `deregisterSubCluster(SubClusterDeregisterRequest request)` Deregister a subcluster identified by `SubClusterId` to change state in federation.
    `GetApplicationHomeSubClusterResponse` | `getApplicationHomeSubCluster(GetApplicationHomeSubClusterRequest request)` Get information about the application identified by the input `ApplicationId`.
    `GetApplicationsHomeSubClusterResponse` | `getApplicationsHomeSubCluster(GetApplicationsHomeSubClusterRequest request)` Get the `ApplicationHomeSubCluster` list representing the mapping of all submitted applications to it's home sub-cluster.
    `Version` | `getCurrentVersion()` Get the `Version` of the underlying federation state store client.
    `GetSubClusterPoliciesConfigurationsResponse` | `getPoliciesConfigurations(GetSubClusterPoliciesConfigurationsRequest request)` Get a map of all queue-to-policy configurations.
    `GetSubClusterPolicyConfigurationResponse` | `getPolicyConfiguration(GetSubClusterPolicyConfigurationRequest request)` Get the policy configuration for a given queue.
    `GetSubClusterInfoResponse` | `getSubCluster(GetSubClusterInfoRequest request)` Get the membership information of subcluster as identified by `SubClusterId`.
    `GetSubClustersInfoResponse` | `getSubClusters(GetSubClustersInfoRequest request)` Get the membership information of all the subclusters that are currently participating in federation.
    `void` | `init(org.apache.hadoop.conf.Configuration conf)` Initialize the FederationStore.
    `Version` | `loadVersion()` Load the version information from the federation state store.
    `SubClusterRegisterResponse` | `registerSubCluster(SubClusterRegisterRequest request)` Register a subcluster by publishing capabilities as represented by `SubClusterInfo` to indicate participation in federation.
    `SetSubClusterPolicyConfigurationResponse` | `setPolicyConfiguration(SetSubClusterPolicyConfigurationRequest request)` Set the policy configuration for a given queue.
    `SubClusterHeartbeatResponse` | `subClusterHeartbeat(SubClusterHeartbeatRequest request)` Periodic heartbeat from a `ResourceManager` participating in federation to indicate liveliness.
    `UpdateApplicationHomeSubClusterResponse` | `updateApplicationHomeSubCluster(UpdateApplicationHomeSubClusterRequest request)` Update the home `SubClusterId` of a previously submitted `ApplicationId`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ZookeeperFederationStateStore

          public ZookeeperFederationStateStore()

  - ### Method Detail

    - #### init

          public void init(org.apache.hadoop.conf.Configuration conf)
                    throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationStateStore`
      Initialize the FederationStore.
      Specified by:
        `init` in interface `FederationStateStore`
      Parameters:
        `conf` - the cluster configuration
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if initialization fails

    - #### close

          public void close()
                     throws Exception

      Description copied from interface: `FederationStateStore`
      Perform any cleanup operations of the StateStore.
      Specified by:
        `close` in interface `FederationStateStore`
      Throws:
        `Exception` - if cleanup fails

    - #### addApplicationHomeSubCluster

          public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster(AddApplicationHomeSubClusterRequest request)
                                                                            throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationApplicationHomeSubClusterStore`
      Register the home `SubClusterId` of the newly submitted `ApplicationId`. Currently response is empty if the operation was successful, if not an exception reporting reason for a failure. If a mapping for the application already existed, the `SubClusterId` in this response will return the existing mapping which might be different from that in the `AddApplicationHomeSubClusterRequest`.
      Specified by:
        `addApplicationHomeSubCluster` in interface `FederationApplicationHomeSubClusterStore`
      Parameters:
        `request` - the request to register a new application with its home sub-cluster
      Returns:
        upon successful registration of the application in the StateStore, `AddApplicationHomeSubClusterRequest` containing the home sub-cluster of the application. Otherwise, an exception reporting reason for a failure
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### updateApplicationHomeSubCluster

          public UpdateApplicationHomeSubClusterResponse updateApplicationHomeSubCluster(UpdateApplicationHomeSubClusterRequest request)
                                                                                  throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationApplicationHomeSubClusterStore`
      Update the home `SubClusterId` of a previously submitted `ApplicationId`. Currently response is empty if the operation was successful, if not an exception reporting reason for a failure.
      Specified by:
        `updateApplicationHomeSubCluster` in interface `FederationApplicationHomeSubClusterStore`
      Parameters:
        `request` - the request to update the home sub-cluster of an application.
      Returns:
        empty on successful update of the application in the StateStore, if not an exception reporting reason for a failure
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### getApplicationHomeSubCluster

          public GetApplicationHomeSubClusterResponse getApplicationHomeSubCluster(GetApplicationHomeSubClusterRequest request)
                                                                            throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationApplicationHomeSubClusterStore`
      Get information about the application identified by the input `ApplicationId`.
      Specified by:
        `getApplicationHomeSubCluster` in interface `FederationApplicationHomeSubClusterStore`
      Parameters:
        `request` - contains the application queried
      Returns:
        `ApplicationHomeSubCluster` containing the application's home subcluster
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### getApplicationsHomeSubCluster

          public GetApplicationsHomeSubClusterResponse getApplicationsHomeSubCluster(GetApplicationsHomeSubClusterRequest request)
                                                                              throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationApplicationHomeSubClusterStore`
      Get the `ApplicationHomeSubCluster` list representing the mapping of all submitted applications to it's home sub-cluster.
      Specified by:
        `getApplicationsHomeSubCluster` in interface `FederationApplicationHomeSubClusterStore`
      Parameters:
        `request` - empty representing all applications
      Returns:
        the mapping of all submitted application to it's home sub-cluster
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### deleteApplicationHomeSubCluster

          public DeleteApplicationHomeSubClusterResponse deleteApplicationHomeSubCluster(DeleteApplicationHomeSubClusterRequest request)
                                                                                  throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationApplicationHomeSubClusterStore`
      Delete the mapping of home `SubClusterId` of a previously submitted `ApplicationId`. Currently response is empty if the operation was successful, if not an exception reporting reason for a failure.
      Specified by:
        `deleteApplicationHomeSubCluster` in interface `FederationApplicationHomeSubClusterStore`
      Parameters:
        `request` - the request to delete the home sub-cluster of an application.
      Returns:
        empty on successful update of the application in the StateStore, if not an exception reporting reason for a failure
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### registerSubCluster

          public SubClusterRegisterResponse registerSubCluster(SubClusterRegisterRequest request)
                                                        throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationMembershipStateStore`
      Register a subcluster by publishing capabilities as represented by `SubClusterInfo` to indicate participation in federation. This is typically done during initialization or restart/failover of the subcluster's `ResourceManager`. Upon successful registration, an identifier for the subcluster which is unique across the federated cluster is returned. The identifier is static, i.e. preserved across restarts and failover.
      Specified by:
        `registerSubCluster` in interface `FederationMembershipStateStore`
      Parameters:
        `request` - the capabilities of the subcluster that wants to participate in federation. The subcluster id is also specified in case registration is triggered by restart/failover
      Returns:
        response empty on successfully if registration was successful
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### deregisterSubCluster

          public SubClusterDeregisterResponse deregisterSubCluster(SubClusterDeregisterRequest request)
                                                            throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationMembershipStateStore`
      Deregister a subcluster identified by `SubClusterId` to change state in federation. This can be done to mark the sub cluster lost, deregistered, or decommissioned.
      Specified by:
        `deregisterSubCluster` in interface `FederationMembershipStateStore`
      Parameters:
        `request` - - the request to deregister the sub-cluster from federation.
      Returns:
        response empty on successfully deregistering the subcluster state
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### subClusterHeartbeat

          public SubClusterHeartbeatResponse subClusterHeartbeat(SubClusterHeartbeatRequest request)
                                                          throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationMembershipStateStore`
      Periodic heartbeat from a `ResourceManager` participating in federation to indicate liveliness. The heartbeat publishes the current capabilities as represented by `SubClusterInfo` of the subcluster. Currently response is empty if the operation was successful, if not an exception reporting reason for a failure.
      Specified by:
        `subClusterHeartbeat` in interface `FederationMembershipStateStore`
      Parameters:
        `request` - the capabilities of the subcluster that wants to keep alive its participation in federation
      Returns:
        response currently empty on if heartbeat was successfully processed
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### getSubCluster

          public GetSubClusterInfoResponse getSubCluster(GetSubClusterInfoRequest request)
                                                  throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationMembershipStateStore`
      Get the membership information of subcluster as identified by `SubClusterId`. The membership information includes the cluster endpoint and current capabilities as represented by `SubClusterInfo`.
      Specified by:
        `getSubCluster` in interface `FederationMembershipStateStore`
      Parameters:
        `request` - the subcluster whose information is required
      Returns:
        the `SubClusterInfo`, or `null` if there is no mapping for the subcluster
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### getSubClusters

          public GetSubClustersInfoResponse getSubClusters(GetSubClustersInfoRequest request)
                                                    throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationMembershipStateStore`
      Get the membership information of all the subclusters that are currently participating in federation. The membership information includes the cluster endpoint and current capabilities as represented by `SubClusterInfo`.
      Specified by:
        `getSubClusters` in interface `FederationMembershipStateStore`
      Parameters:
        `request` - request for sub-clusters information
      Returns:
        a map of `SubClusterInfo` keyed by the `SubClusterId`
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### getPolicyConfiguration

          public GetSubClusterPolicyConfigurationResponse getPolicyConfiguration(GetSubClusterPolicyConfigurationRequest request)
                                                                          throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationPolicyStore`
      Get the policy configuration for a given queue.
      Specified by:
        `getPolicyConfiguration` in interface `FederationPolicyStore`
      Parameters:
        `request` - the queue whose `SubClusterPolicyConfiguration` is required
      Returns:
        the `SubClusterPolicyConfiguration` for the specified queue, or `null` if there is no mapping for the queue
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### setPolicyConfiguration

          public SetSubClusterPolicyConfigurationResponse setPolicyConfiguration(SetSubClusterPolicyConfigurationRequest request)
                                                                          throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationPolicyStore`
      Set the policy configuration for a given queue.
      Specified by:
        `setPolicyConfiguration` in interface `FederationPolicyStore`
      Parameters:
        `request` - the `SubClusterPolicyConfiguration` with the corresponding queue
      Returns:
        response empty on successfully updating the `SubClusterPolicyConfiguration` for the specified queue
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### getPoliciesConfigurations

          public GetSubClusterPoliciesConfigurationsResponse getPoliciesConfigurations(GetSubClusterPoliciesConfigurationsRequest request)
                                                                                throws org.apache.hadoop.yarn.exceptions.YarnException

      Description copied from interface: `FederationPolicyStore`
      Get a map of all queue-to-policy configurations.
      Specified by:
        `getPoliciesConfigurations` in interface `FederationPolicyStore`
      Parameters:
        `request` - empty to represent all configured queues in the system
      Returns:
        the policies for all currently active queues in the system
      Throws:
        `org.apache.hadoop.yarn.exceptions.YarnException` - if the request is invalid/fails

    - #### getCurrentVersion

          public Version getCurrentVersion()

      Description copied from interface: `FederationStateStore`
      Get the `Version` of the underlying federation state store client.
      Specified by:
        `getCurrentVersion` in interface `FederationStateStore`
      Returns:
        the `Version` of the underlying federation store client

    - #### loadVersion

          public Version loadVersion()

      Description copied from interface: `FederationStateStore`
      Load the version information from the federation state store.
      Specified by:
        `loadVersion` in interface `FederationStateStore`
      Returns:
        the `Version` of the federation state store

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.