protected void reconfigureNumberOfJobsToAcquire(JobAcquisitionContext context) { // calculate the number of jobs to acquire next time jobsToAcquire.clear(); for (Map.Entry<String, AcquiredJobs> acquiredJobsEntry : context.getAcquiredJobsByEngine().entrySet()) { String engineName = acquiredJobsEntry.getKey(); int numJobsToAcquire = (int) (baseNumJobsToAcquire * Math.pow(backoffIncreaseFactor, backoffLevel)); List<List<String>> rejectedJobBatchesForEngine = context.getRejectedJobsByEngine().get(engineName); if (rejectedJobBatchesForEngine != null) { numJobsToAcquire -= rejectedJobBatchesForEngine.size(); } numJobsToAcquire = Math.max(0, numJobsToAcquire); jobsToAcquire.put(engineName, numJobsToAcquire); } }
protected void reconfigureNumberOfJobsToAcquire(JobAcquisitionContext context) { // calculate the number of jobs to acquire next time jobsToAcquire.clear(); for (Map.Entry<String, AcquiredJobs> acquiredJobsEntry : context.getAcquiredJobsByEngine().entrySet()) { String engineName = acquiredJobsEntry.getKey(); int numJobsToAcquire = (int) (baseNumJobsToAcquire * Math.pow(backoffIncreaseFactor, backoffLevel)); List<List<String>> rejectedJobBatchesForEngine = context.getRejectedJobsByEngine().get(engineName); if (rejectedJobBatchesForEngine != null) { numJobsToAcquire -= rejectedJobBatchesForEngine.size(); } numJobsToAcquire = Math.max(0, numJobsToAcquire); jobsToAcquire.put(engineName, numJobsToAcquire); } }
/** * @return true, if all acquired jobs (spanning all engines) were rejected for execution */ protected boolean allSubmittedJobsRejected(JobAcquisitionContext context) { for (Map.Entry<String, AcquiredJobs> acquiredJobsForEngine : context.getAcquiredJobsByEngine().entrySet()) { String engineName = acquiredJobsForEngine.getKey(); List<List<String>> acquiredJobBatches = acquiredJobsForEngine.getValue().getJobIdBatches(); List<List<String>> resubmittedJobBatches = context.getAdditionalJobsByEngine().get(engineName); List<List<String>> rejectedJobBatches = context.getRejectedJobsByEngine().get(engineName); int numJobsSubmittedForExecution = acquiredJobBatches.size(); if (resubmittedJobBatches != null) { numJobsSubmittedForExecution += resubmittedJobBatches.size(); } int numJobsRejected = 0; if (rejectedJobBatches != null) { numJobsRejected += rejectedJobBatches.size(); } // if not all jobs scheduled for execution have been rejected if (numJobsRejected == 0 || numJobsSubmittedForExecution > numJobsRejected) { return false; } } return true; }
/** * @return true, if all acquired jobs (spanning all engines) were rejected for execution */ protected boolean allSubmittedJobsRejected(JobAcquisitionContext context) { for (Map.Entry<String, AcquiredJobs> acquiredJobsForEngine : context.getAcquiredJobsByEngine().entrySet()) { String engineName = acquiredJobsForEngine.getKey(); List<List<String>> acquiredJobBatches = acquiredJobsForEngine.getValue().getJobIdBatches(); List<List<String>> resubmittedJobBatches = context.getAdditionalJobsByEngine().get(engineName); List<List<String>> rejectedJobBatches = context.getRejectedJobsByEngine().get(engineName); int numJobsSubmittedForExecution = acquiredJobBatches.size(); if (resubmittedJobBatches != null) { numJobsSubmittedForExecution += resubmittedJobBatches.size(); } int numJobsRejected = 0; if (rejectedJobBatches != null) { numJobsRejected += rejectedJobBatches.size(); } // if not all jobs scheduled for execution have been rejected if (numJobsRejected == 0 || numJobsSubmittedForExecution > numJobsRejected) { return false; } } return true; }
protected void reconfigureNumberOfJobsToAcquire(JobAcquisitionContext context) { // calculate the number of jobs to acquire next time jobsToAcquire.clear(); for (Map.Entry<String, AcquiredJobs> acquiredJobsEntry : context.getAcquiredJobsByEngine().entrySet()) { String engineName = acquiredJobsEntry.getKey(); int numJobsToAcquire = (int) (baseNumJobsToAcquire * Math.pow(backoffIncreaseFactor, backoffLevel)); List<List<String>> rejectedJobBatchesForEngine = context.getRejectedJobsByEngine().get(engineName); if (rejectedJobBatchesForEngine != null) { numJobsToAcquire -= rejectedJobBatchesForEngine.size(); } numJobsToAcquire = Math.max(0, numJobsToAcquire); jobsToAcquire.put(engineName, numJobsToAcquire); } }
/** * @return true, if all acquired jobs (spanning all engines) were rejected for execution */ protected boolean allSubmittedJobsRejected(JobAcquisitionContext context) { for (Map.Entry<String, AcquiredJobs> acquiredJobsForEngine : context.getAcquiredJobsByEngine().entrySet()) { String engineName = acquiredJobsForEngine.getKey(); List<List<String>> acquiredJobBatches = acquiredJobsForEngine.getValue().getJobIdBatches(); List<List<String>> resubmittedJobBatches = context.getAdditionalJobsByEngine().get(engineName); List<List<String>> rejectedJobBatches = context.getRejectedJobsByEngine().get(engineName); int numJobsSubmittedForExecution = acquiredJobBatches.size(); if (resubmittedJobBatches != null) { numJobsSubmittedForExecution += resubmittedJobBatches.size(); } int numJobsRejected = 0; if (rejectedJobBatches != null) { numJobsRejected += rejectedJobBatches.size(); } // if not all jobs scheduled for execution have been rejected if (numJobsRejected == 0 || numJobsSubmittedForExecution > numJobsRejected) { return false; } } return true; }