@Test public void testCluster() { Cluster.loadHadoopClustersProps("testhRavenClusters.properties"); Configuration c = new Configuration(false); c.set(JobDescFactory.JOBTRACKER_KEY, "cluster1.identifier1.example.com:8021"); String result = JobDescFactory.getCluster(c); assertEquals("cluster1@identifier1", result); c = new Configuration(false); c.set(JobDescFactory.JOBTRACKER_KEY, "hbase-cluster2.identifier2.example.com:8021"); result = JobDescFactory.getCluster(c); assertEquals("hbase-cluster2@identifier2", result); c = new Configuration(false); c.set(JobDescFactory.RESOURCE_MANAGER_KEY, "cluster2.identifier2.example.com:10020"); result = JobDescFactory.getCluster(c); assertEquals("cluster2@identifier2", result); c = new Configuration(false); c.set(JobDescFactory.JOBTRACKER_KEY, ""); result = JobDescFactory.getCluster(c); assertNull(result); c = new Configuration(false); result = JobDescFactory.getCluster(c); assertNull(result); }
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) { int portIdx = jobtracker.indexOf(':'); if (portIdx > -1) { jobtracker = jobtracker.substring(0, portIdx); } cluster = Cluster.getIdentifier(jobtracker); } return cluster; }
JobDescFactory { 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) { int portIdx = jobtracker.indexOf(':'); if (portIdx > -1) { jobtracker = jobtracker.substring(0, portIdx); } cluster = Cluster.getIdentifier(jobtracker); } return cluster; } }
JobDescFactory { 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) { int portIdx = jobtracker.indexOf(':'); if (portIdx > -1) { jobtracker = jobtracker.substring(0, portIdx); } cluster = Cluster.getIdentifier(jobtracker); } return cluster; }  }
JobDescFactory { 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) { int portIdx = jobtracker.indexOf(':'); if (portIdx > -1) { jobtracker = jobtracker.substring(0, portIdx); } cluster = Cluster.getIdentifier(jobtracker); } return cluster; }  static JobDescFactoryBase getFrameworkSpecificJobDescFactory(Configuration jobConf); static JobDesc createJobDesc(QualifiedJobId qualifiedJobId,
      long submitTimeMillis, Configuration jobConf); static Framework getFramework(Configuration jobConf); static String getCluster(Configuration jobConf); }
JobDescFactory { 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) { int portIdx = jobtracker.indexOf(':'); if (portIdx > -1) { jobtracker = jobtracker.substring(0, portIdx); } cluster = Cluster.getIdentifier(jobtracker); } return cluster; }  static JobDescFactoryBase getFrameworkSpecificJobDescFactory(Configuration jobConf); static JobDesc createJobDesc(QualifiedJobId qualifiedJobId,
      long submitTimeMillis, Configuration jobConf); static Framework getFramework(Configuration jobConf); static String getCluster(Configuration jobConf); static final String JOBTRACKER_KEY; static final String RESOURCE_MANAGER_KEY; }