mapredConf.setBoolean(Job.MAPREDUCE_JOB_USER_CLASSPATH_FIRST, true);
if (UserGroupInformation.isSecurityEnabled()) {
// If runs in secure cluster, this program runner is running in a yarn container, hence not able
// to get authenticated with the history and MR-AM.
mapredConf.unset("mapreduce.jobhistory.address");
mapredConf.setBoolean(MRJobConfig.JOB_AM_ACCESS_DISABLED, true);
Credentials credentials = UserGroupInformation.getCurrentUser().getCredentials();
LOG.info("Running in secure mode; adding all user credentials: {}", credentials.getAllTokens());
job.getCredentials().addAll(credentials);