diff --git a/app/com/linkedin/drelephant/ElephantRunner.java b/app/com/linkedin/drelephant/ElephantRunner.java index 4409348be..319ffe852 100644 --- a/app/com/linkedin/drelephant/ElephantRunner.java +++ b/app/com/linkedin/drelephant/ElephantRunner.java @@ -33,7 +33,7 @@ import model.JobResult; import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.conf.Configuration; import org.apache.log4j.Logger; @@ -49,7 +49,7 @@ public class ElephantRunner implements Runnable { private AnalyticJobGenerator _analyticJobGenerator; private void loadAnalyticJobGenerator() { - JobConf configuration = new JobConf(); + Configuration configuration = new Configuration(); if (HadoopSystemContext.isHadoop2Env()) { _analyticJobGenerator = new AnalyticJobGeneratorHadoop2(); } else { diff --git a/app/com/linkedin/drelephant/HadoopSecurity.java b/app/com/linkedin/drelephant/HadoopSecurity.java index 61700c08f..744b82831 100644 --- a/app/com/linkedin/drelephant/HadoopSecurity.java +++ b/app/com/linkedin/drelephant/HadoopSecurity.java @@ -16,7 +16,6 @@ package com.linkedin.drelephant; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.security.UserGroupInformation; import org.apache.log4j.Logger; @@ -36,7 +35,7 @@ public class HadoopSecurity { private boolean _securityEnabled = false; public HadoopSecurity() throws IOException { - Configuration conf = new JobConf(); + Configuration conf = new Configuration(); UserGroupInformation.setConfiguration(conf); _securityEnabled = UserGroupInformation.isSecurityEnabled(); if (_securityEnabled) { diff --git a/app/com/linkedin/drelephant/analysis/HadoopSystemContext.java b/app/com/linkedin/drelephant/analysis/HadoopSystemContext.java index 1e40cc16c..5ed366cd9 100644 --- a/app/com/linkedin/drelephant/analysis/HadoopSystemContext.java +++ b/app/com/linkedin/drelephant/analysis/HadoopSystemContext.java @@ -16,28 +16,12 @@ package com.linkedin.drelephant.analysis; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapred.JobConf; public final class HadoopSystemContext { private static final String MAPREDUCE_FRAMEWORK_NAME_PROP = "mapreduce.framework.name"; private static final String MAPRED_JOB_TRACKER_PROP = "mapred.job.tracker.http.address"; private static final String YARN = "yarn"; - private static final String CLASSIC = "classic"; - - /** - * Detect if the current Hadoop environment is 1.x - * - * @return true if it is Hadoop 1 env, else false - */ - public static boolean isHadoop1Env() { - Configuration hadoopConf = new JobConf(); - String hadoopVersion = hadoopConf.get(MAPREDUCE_FRAMEWORK_NAME_PROP); - if (hadoopVersion == null) { - return hadoopConf.get(MAPRED_JOB_TRACKER_PROP) != null; - } - return hadoopVersion.equals(CLASSIC); - } /** * Detect if the current Hadoop environment is 2.x @@ -45,7 +29,7 @@ public static boolean isHadoop1Env() { * @return true if it is Hadoop 2 env, else false */ public static boolean isHadoop2Env() { - Configuration hadoopConf = new JobConf(); + Configuration hadoopConf = new Configuration(); String hadoopVersion = hadoopConf.get(MAPREDUCE_FRAMEWORK_NAME_PROP); return hadoopVersion != null && hadoopVersion.equals(YARN); } @@ -57,6 +41,6 @@ public static boolean isHadoop2Env() { * @return true if we have a major version match else false */ public static boolean matchCurrentHadoopVersion(int majorVersion) { - return majorVersion == 2 && isHadoop2Env() || majorVersion == 1 && isHadoop1Env(); + return majorVersion == 2 && isHadoop2Env(); } } diff --git a/app/com/linkedin/drelephant/mapreduce/MapReduceFetcherHadoop2.java b/app/com/linkedin/drelephant/mapreduce/MapReduceFetcherHadoop2.java index 36c0321e6..981106ce2 100644 --- a/app/com/linkedin/drelephant/mapreduce/MapReduceFetcherHadoop2.java +++ b/app/com/linkedin/drelephant/mapreduce/MapReduceFetcherHadoop2.java @@ -33,7 +33,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.authentication.client.AuthenticatedURL; import org.apache.hadoop.security.authentication.client.AuthenticationException; import org.apache.log4j.Logger; @@ -51,7 +51,7 @@ public class MapReduceFetcherHadoop2 implements ElephantFetcher