org.apache.hadoop.mapreduce

## Class Cluster

- java.lang.Object
- - org.apache.hadoop.mapreduce.Cluster

-     @InterfaceAudience.Public
       @InterfaceStability.Evolving
      public class Cluster
      extends Object

  Provides a way to access information about the map/reduce cluster.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Cluster.JobTrackerStatus`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Cluster(org.apache.hadoop.conf.Configuration conf)`
    `Cluster(InetSocketAddress jobTrackAddr, org.apache.hadoop.conf.Configuration conf)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancelDelegationToken(org.apache.hadoop.security.token.Token<DelegationTokenIdentifier> token)` Deprecated. Use `Token.cancel(org.apache.hadoop.conf.Configuration)` instead
    `void` | `close()` Close the `Cluster`.
    `TaskTrackerInfo[]` | `getActiveTaskTrackers()` Get all active trackers in the cluster.
    `Job[]` | `getAllJobs()` Deprecated. Use `getAllJobStatuses()` instead.
    `JobStatus[]` | `getAllJobStatuses()` Get job status for all jobs in the cluster.
    `TaskTrackerInfo[]` | `getBlackListedTaskTrackers()` Get blacklisted trackers.
    `QueueInfo[]` | `getChildQueues(String queueName)` Returns immediate children of queueName.
    `ClusterMetrics` | `getClusterStatus()` Get current cluster status.
    `org.apache.hadoop.security.token.Token<DelegationTokenIdentifier>` | `getDelegationToken(org.apache.hadoop.io.Text renewer)` Get a delegation token for the user from the JobTracker.
    `org.apache.hadoop.fs.FileSystem` | `getFileSystem()` Get the file system where job-specific files are stored
    `Job` | `getJob(JobID jobId)` Get job corresponding to jobid.
    `String` | `getJobHistoryUrl(JobID jobId)` Get the job history file path for a given job id.
    `Cluster.JobTrackerStatus` | `getJobTrackerStatus()` Get the JobTracker's status.
    `LogParams` | `getLogParams(JobID jobID, TaskAttemptID taskAttemptID)` Get log parameters for the specified jobID or taskAttemptID
    `QueueInfo` | `getQueue(String name)` Get queue information for the specified name.
    `QueueAclsInfo[]` | `getQueueAclsForCurrentUser()` Gets the Queue ACLs for current user
    `QueueInfo[]` | `getQueues()` Get all the queues in cluster.
    `QueueInfo[]` | `getRootQueues()` Gets the root level queues.
    `org.apache.hadoop.fs.Path` | `getStagingAreaDir()` Grab the jobtracker's view of the staging directory path where job-specific files will be placed.
    `org.apache.hadoop.fs.Path` | `getSystemDir()` Grab the jobtracker system directory path where job-specific files will be placed.
    `long` | `getTaskTrackerExpiryInterval()` Get the tasktracker expiry interval for the cluster
    `long` | `renewDelegationToken(org.apache.hadoop.security.token.Token<DelegationTokenIdentifier> token)` Deprecated. Use `Token.renew(org.apache.hadoop.conf.Configuration)` instead

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

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

- - ### Constructor Detail

    - #### Cluster

          public Cluster(org.apache.hadoop.conf.Configuration conf)
                  throws IOException

      Throws:
        `IOException`

    - #### Cluster

          public Cluster(InetSocketAddress jobTrackAddr,
                         org.apache.hadoop.conf.Configuration conf)
                  throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Close the `Cluster`.
      Throws:
        `IOException`

    - #### getFileSystem

          public org.apache.hadoop.fs.FileSystem getFileSystem()
                                                        throws IOException,
                                                               InterruptedException

      Get the file system where job-specific files are stored
      Returns:
        object of FileSystem
      Throws:
        `IOException`
        `InterruptedException`

    - #### getJob

          public Job getJob(JobID jobId)
                     throws IOException,
                            InterruptedException

      Get job corresponding to jobid.
      Parameters:
        `jobId` -
      Returns:
        object of `Job`
      Throws:
        `IOException`
        `InterruptedException`

    - #### getQueues

          public QueueInfo[] getQueues()
                                throws IOException,
                                       InterruptedException

      Get all the queues in cluster.
      Returns:
        array of `QueueInfo`
      Throws:
        `IOException`
        `InterruptedException`

    - #### getQueue

          public QueueInfo getQueue(String name)
                             throws IOException,
                                    InterruptedException

      Get queue information for the specified name.
      Parameters:
        `name` - queuename
      Returns:
        object of `QueueInfo`
      Throws:
        `IOException`
        `InterruptedException`

    - #### getLogParams

          public LogParams getLogParams(JobID jobID,
                                        TaskAttemptID taskAttemptID)
                                 throws IOException,
                                        InterruptedException

      Get log parameters for the specified jobID or taskAttemptID
      Parameters:
        `jobID` - the job id.
        `taskAttemptID` - the task attempt id. Optional.
      Returns:
        the LogParams
      Throws:
        `IOException`
        `InterruptedException`

    - #### getClusterStatus

          public ClusterMetrics getClusterStatus()
                                          throws IOException,
                                                 InterruptedException

      Get current cluster status.
      Returns:
        object of `ClusterMetrics`
      Throws:
        `IOException`
        `InterruptedException`

    - #### getActiveTaskTrackers

          public TaskTrackerInfo[] getActiveTaskTrackers()
                                                  throws IOException,
                                                         InterruptedException

      Get all active trackers in the cluster.
      Returns:
        array of `TaskTrackerInfo`
      Throws:
        `IOException`
        `InterruptedException`

    - #### getBlackListedTaskTrackers

          public TaskTrackerInfo[] getBlackListedTaskTrackers()
                                                       throws IOException,
                                                              InterruptedException

      Get blacklisted trackers.
      Returns:
        array of `TaskTrackerInfo`
      Throws:
        `IOException`
        `InterruptedException`

    - #### getAllJobs

          @Deprecated
          public Job[] getAllJobs()
                                       throws IOException,
                                              InterruptedException

      Deprecated. Use `getAllJobStatuses()` instead.
      Get all the jobs in cluster.
      Returns:
        array of `Job`
      Throws:
        `IOException`
        `InterruptedException`

    - #### getAllJobStatuses

          public JobStatus[] getAllJobStatuses()
                                        throws IOException,
                                               InterruptedException

      Get job status for all jobs in the cluster.
      Returns:
        job status for all jobs in cluster
      Throws:
        `IOException`
        `InterruptedException`

    - #### getSystemDir

          public org.apache.hadoop.fs.Path getSystemDir()
                                                 throws IOException,
                                                        InterruptedException

      Grab the jobtracker system directory path where job-specific files will be placed.
      Returns:
        the system directory where job-specific files are to be placed.
      Throws:
        `IOException`
        `InterruptedException`

    - #### getStagingAreaDir

          public org.apache.hadoop.fs.Path getStagingAreaDir()
                                                      throws IOException,
                                                             InterruptedException

      Grab the jobtracker's view of the staging directory path where job-specific files will be placed.
      Returns:
        the staging directory where job-specific files are to be placed.
      Throws:
        `IOException`
        `InterruptedException`

    - #### getJobHistoryUrl

          public String getJobHistoryUrl(JobID jobId)
                                  throws IOException,
                                         InterruptedException

      Get the job history file path for a given job id. The job history file at this path may or may not be existing depending on the job completion state. The file is present only for the completed jobs.
      Parameters:
        `jobId` - the JobID of the job submitted by the current user.
      Returns:
        the file path of the job history file
      Throws:
        `IOException`
        `InterruptedException`

    - #### getQueueAclsForCurrentUser

          public QueueAclsInfo[] getQueueAclsForCurrentUser()
                                                     throws IOException,
                                                            InterruptedException

      Gets the Queue ACLs for current user
      Returns:
        array of QueueAclsInfo object for current user.
      Throws:
        `IOException`
        `InterruptedException`

    - #### getRootQueues

          public QueueInfo[] getRootQueues()
                                    throws IOException,
                                           InterruptedException

      Gets the root level queues.
      Returns:
        array of JobQueueInfo object.
      Throws:
        `IOException`
        `InterruptedException`

    - #### getChildQueues

          public QueueInfo[] getChildQueues(String queueName)
                                     throws IOException,
                                            InterruptedException

      Returns immediate children of queueName.
      Parameters:
        `queueName` -
      Returns:
        array of JobQueueInfo which are children of queueName
      Throws:
        `IOException`
        `InterruptedException`

    - #### getJobTrackerStatus

          public Cluster.JobTrackerStatus getJobTrackerStatus()
                                                       throws IOException,
                                                              InterruptedException

      Get the JobTracker's status.
      Returns:
        `Cluster.JobTrackerStatus` of the JobTracker
      Throws:
        `IOException`
        `InterruptedException`

    - #### getTaskTrackerExpiryInterval

          public long getTaskTrackerExpiryInterval()
                                            throws IOException,
                                                   InterruptedException

      Get the tasktracker expiry interval for the cluster
      Returns:
        the expiry interval in msec
      Throws:
        `IOException`
        `InterruptedException`

    - #### getDelegationToken

          public org.apache.hadoop.security.token.Token<DelegationTokenIdentifier> getDelegationToken(org.apache.hadoop.io.Text renewer)
                                                                                               throws IOException,
                                                                                                      InterruptedException

      Get a delegation token for the user from the JobTracker.
      Parameters:
        `renewer` - the user who can renew the token
      Returns:
        the new token
      Throws:
        `IOException`
        `InterruptedException`

    - #### renewDelegationToken

          public long renewDelegationToken(org.apache.hadoop.security.token.Token<DelegationTokenIdentifier> token)
                                    throws org.apache.hadoop.security.token.SecretManager.InvalidToken,
                                           IOException,
                                           InterruptedException

      Deprecated. Use `Token.renew(org.apache.hadoop.conf.Configuration)` instead
      Renew a delegation token
      Parameters:
        `token` - the token to renew
      Returns:
        the new expiration time
      Throws:
        `org.apache.hadoop.security.token.SecretManager.InvalidToken`
        `IOException`
        `InterruptedException`

    - #### cancelDelegationToken

          public void cancelDelegationToken(org.apache.hadoop.security.token.Token<DelegationTokenIdentifier> token)
                                     throws IOException,
                                            InterruptedException

      Deprecated. Use `Token.cancel(org.apache.hadoop.conf.Configuration)` instead
      Cancel a delegation token from the JobTracker
      Parameters:
        `token` - the token to cancel
      Throws:
        `IOException`
        `InterruptedException`

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