private void checkToDisableTuning(Set<JobDefinition> jobDefinitionSet) {
    for (JobDefinition jobDefinition : jobDefinitionSet) {
        List<TuningJobExecutionParamSet> tuningJobExecutionParamSets =
            TuningJobExecutionParamSet.find.fetch(TuningJobExecutionParamSet.TABLE.jobSuggestedParamSet, "*")
                .fetch(TuningJobExecutionParamSet.TABLE.jobExecution, "*")
                .where()
                .eq(TuningJobExecutionParamSet.TABLE.jobSuggestedParamSet + '.'
                    + JobSuggestedParamSet.TABLE.jobDefinition + '.' + JobDefinition.TABLE.id, jobDefinition.id)
                .order()
                .desc("job_execution_id")
                .findList();

        if (tuningJobExecutionParamSets.size() >= minTuningExecutions) {
          if (didParameterSetConverge(tuningJobExecutionParamSets)) {
            logger.info("Parameters converged. Disabling tuning for job: " + jobDefinition.jobName);
            disableTuning(jobDefinition, "Parameters converged");
          } else if (isMedianGainNegative(tuningJobExecutionParamSets)) {
            logger.info("Unable to get gain while tuning. Disabling tuning for job: " + jobDefinition.jobName);
            disableTuning(jobDefinition, "Unable to get gain");
          } else if (tuningJobExecutionParamSets.size() >= maxTuningExecutions) {
            logger.info("Maximum tuning executions limit reached. Disabling tuning for job: " + jobDefinition.jobName);
            disableTuning(jobDefinition, "Maximum executions reached");
          }
        }
    }
  }
Checks and disables tuning for the given job definitions.
Tuning can be disabled if:
 - Number of tuning executions >=  maxTuningExecutions
 - or number of tuning executions >= minTuningExecutions and parameters converge
 - or number of tuning executions >= minTuningExecutions and median gain (in cost function) in last 6 executions is negative
@param jobDefinitionSet Set of jobs to check if tuning can be switched off for them
app/com/linkedin/drelephant/tuning/FitnessComputeUtil.java