public static String getCluster ( Configuration jobConf ) { String jobtracker = jobConf . get ( RESOURCE_MANAGER_KEY ) ; if ( jobtracker == null ) { jobtracker = jobConf . get ( JOBTRACKER_KEY ) ; } String cluster = null ; if ( jobtracker != null ) { // strip any port number int portIdx = jobtracker . indexOf ( ' ' ) ; if ( portIdx > - 1 ) { jobtracker = jobtracker . substring ( 0 , portIdx ) ; } // An ExceptionInInitializerError may be thrown to indicate that an exception occurred during // evaluation of Cluster class' static initialization cluster = Cluster . getIdentifier ( jobtracker ) ; } return cluster ; }
Returns the cluster that a give job was run on by mapping the jobtracker hostname to an identifier .