Source:
public static void main(final String[] args) throws Exception { int jobTryCount = 1; Properties jobProps = HadoopSecureWrapperUtils.loadAzkabanProps(); Props initialJobprops = new Props(null, jobProps); boolean retry = false; boolean firstTry = true; int maxJobRetry = 2; if (initialJobprops.containsKey(TUNING_JOB_RETRY_COUNT)) { maxJobRetry = initialJobprops.getInt(TUNING_JOB_RETRY_COUNT); } while (jobTryCount <= maxJobRetry && (retry || firstTry)) { TuningParameterUtils tuningParameterUtils = new TuningParameterUtils(); jobTryCount++; firstTry = false; props = Props.clone(initialJobprops); props.put(TuningCommonConstants.AUTO_TUNING_RETRY, String.valueOf(retry)); tuningParameterUtils.updateAutoTuningParameters(props); HadoopTuningConfigurationInjector.prepareResourcesToInject(props, HadoopTuningSecurePigWrapper.getWorkingDirectory(props)); HadoopTuningConfigurationInjector.injectResources(props); pigLogFile = new File(System.getenv("PIG_LOG_FILE")); try { if (HadoopSecureWrapperUtils.shouldProxy(jobProps)) { String tokenFile = System.getenv(HADOOP_TOKEN_FILE_LOCATION); UserGroupInformation proxyUser = HadoopSecureWrapperUtils.setupProxyUser(jobProps, tokenFile, logger); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { runPigJob(args); return null; } }); } else { runPigJob(args); } } catch (TuningException t) { retry = false; System.out.println("TryCount:" + jobTryCount + ", maxRetry:" + maxJobRetry); if (jobTryCount <= maxJobRetry) { System.out.println("Error due to auto tuning parameters "); retry = true; } else { throw t; } } catch (Exception t) { throw t; } } }

Target:
public static void main(final String[] args) throws Exception { int jobTryCount = 1; Properties jobProps = HadoopSecureWrapperUtils.loadAzkabanProps(); Props initialJobprops = new Props(null, jobProps); boolean retry = false; boolean firstTry = true; int maxJobRetry = 2; if (initialJobprops.containsKey(TuningCommonConstants.TUNING_JOB_RETRY_COUNT)) { maxJobRetry = initialJobprops.getInt(TuningCommonConstants.TUNING_JOB_RETRY_COUNT); } while (jobTryCount <= maxJobRetry && (retry || firstTry)) { TuningParameterUtils tuningParameterUtils = new TuningParameterUtils(); jobTryCount++; firstTry = false; props = Props.clone(initialJobprops); props.put(TuningCommonConstants.AUTO_TUNING_RETRY, String.valueOf(retry)); tuningParameterUtils.updateAutoTuningParameters(props); HadoopTuningConfigurationInjector.prepareResourcesToInject(props, HadoopTuningSecurePigWrapper.getWorkingDirectory(props)); HadoopTuningConfigurationInjector.injectResources(props); pigLogFile = new File(System.getenv(PigCommonConstants.PIG_LOG_FILE)); try { if (HadoopSecureWrapperUtils.shouldProxy(jobProps)) { String tokenFile = System.getenv(HADOOP_TOKEN_FILE_LOCATION); UserGroupInformation proxyUser = HadoopSecureWrapperUtils.setupProxyUser(jobProps, tokenFile, logger); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { runPigJob(args); return null; } }); } else { runPigJob(args); } } catch (TuningException t) { retry = false; System.out.println("TryCount:" + jobTryCount + ", maxRetry:" + maxJobRetry); if (jobTryCount <= maxJobRetry) { System.out.println("Error due to auto tuning parameters "); retry = true; } else { throw t; } } catch (Exception t) { throw t; } } }