Package com.redwood.scheduler.api.job
Class JobForecaster
- java.lang.Object
- 
- com.redwood.scheduler.api.job.JobForecaster
 
- 
- All Implemented Interfaces:
- JobForecastContext,- JobForecasterComp
 
 public class JobForecaster extends Object implements JobForecastContext, JobForecasterComp Job forecasting.
- 
- 
Field SummaryFields Modifier and Type Field Description static Comparator<ForecastJob>FORECASTJOBCOMPARATOR
 - 
Constructor SummaryConstructors Constructor Description JobForecaster()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RWIterable<ForecastJob>forecast(SchedulerSession session, DateTimeZone at)Create forecast jobs for all active job groups at the specified date.ForecastJobforecastChildJobs(SchedulerSession session, Long jobId)For job chains, the job chain run will be simulated.RWIterable<ForecastJob>forecastJobs(SchedulerSession session, DateTimeZone begin, DateTimeZone end, List<Long> jobUniqueIds)Create forecast jobs for all active job groups at the specified date range.Map<Long,ForecastJob>forecastJobs(SchedulerSession session, DateTimeZone begin, DateTimeZone end, List<Long> jobUniqueIds, long maxForecastCount)Create forecast jobs for all active job groups at the specified date range.static StringforecastJobToString(ForecastJob fj)Get a string representation of a forecasted job.Collection<Throwable>getExceptions()Get the exceptions that occurred during forecasting.static List<Long>getJobsForProcessServers(SchedulerSession session, List<Long> processServerIds, DateTimeZone jobsFrom, DateTimeZone jobsTo, boolean includeMaintenanceJobs)A helper function for a request to forecast the jobs in a set of process servers where the scheduled start time of the jobs are in a certain time range.static List<Long>getJobsForQueues(SchedulerSession session, List<Long> queueIds, DateTimeZone jobsFrom, DateTimeZone jobsTo, boolean includeMaintenanceJobs)A helper function for a request to forecast the jobs in a set of queues where the scheduled start time of the jobs are in a certain time range.static List<Long>getJobsForRelatedEntity(SchedulerSession session, String entityType, List<Long> entityIds, DateTimeZone jobsFrom, DateTimeZone jobsTo, boolean includeMaintenanceJobs)A helper function for a request to forecast the jobs in a set of entities (queues, process servers) where the scheduled start time of the jobs are in a certain time range.booleanincludeExistingJobs()Are existing jobs included in the result or only return the forecasts when forecasting the jobs in a job group.voidsetIncludeExistingJobs(boolean newIncludeExistingJobs)Include existing jobs or not.
 
- 
- 
- 
Field Detail- 
FORECASTJOBCOMPARATORpublic static final Comparator<ForecastJob> FORECASTJOBCOMPARATOR 
 
- 
 - 
Method Detail- 
forecastJobToStringpublic static String forecastJobToString(ForecastJob fj) Get a string representation of a forecasted job.- Parameters:
- fj- the forecasted job.
- Returns:
- a string representation.
 
 - 
forecastpublic RWIterable<ForecastJob> forecast(SchedulerSession session, DateTimeZone at) throws com.redwood.scheduler.api.exception.SchedulerAPIException Create forecast jobs for all active job groups at the specified date.- Specified by:
- forecastin interface- JobForecasterComp
- Parameters:
- session- in which to forecast.
- at- is the date and time to forecast.
- Returns:
- iterator with ForecastJobs
- Throws:
- com.redwood.scheduler.api.exception.SchedulerAPIException- if errors are encountered while computing the ForecastJobs.
 
 - 
forecastJobspublic RWIterable<ForecastJob> forecastJobs(SchedulerSession session, DateTimeZone begin, DateTimeZone end, List<Long> jobUniqueIds) throws com.redwood.scheduler.api.exception.SchedulerAPIException Create forecast jobs for all active job groups at the specified date range. If jobUniqueIds is null, all jobs in the system will be forecast. Note that forecasts cannot be persisted.- Specified by:
- forecastJobsin interface- JobForecasterComp
- Parameters:
- session- in which to forecast.
- begin- of the forecast period; an empty list will be returned if not specified.
- end- of the forecast period; an empty list will be returned if not specified.
- jobUniqueIds- is an optional list of Long or UniqueIdObjects, containing the uniqueIds for the jobs to forecast.
- Returns:
- iterator with ForecastJobs.
- Throws:
- com.redwood.scheduler.api.exception.SchedulerAPIException- if errors are encountered while computing the ForecastJobs.
 
 - 
forecastJobspublic Map<Long,ForecastJob> forecastJobs(SchedulerSession session, DateTimeZone begin, DateTimeZone end, List<Long> jobUniqueIds, long maxForecastCount) Create forecast jobs for all active job groups at the specified date range. If no jobUniqueIds are specified, all jobs in the system will be forecast. Note that forecasts cannot be persisted. No more than maxForecastCount items will be returned. The algorithm is such, that the forecasts will be limited in time, not in job groups. There are no missing forecasts between the first and the last returned forecast job.- Parameters:
- session- in which to forecast.
- begin- of the forecast period; an empty list will be returned if not specified.
- end- of the forecast period; if not specified, forecast period is at begin date.
- jobUniqueIds- is an optional list of Long or UniqueIdObjects, containing the uniqueIds for the jobs to forecast.
- maxForecastCount- is the maximum number of forecast jobs to be returned.
- Returns:
- map with ForecastJobs, keyed by their unique id.
 
 - 
forecastChildJobspublic ForecastJob forecastChildJobs(SchedulerSession session, Long jobId) For job chains, the job chain run will be simulated.- Parameters:
- session- in which to forecast.
- jobId- to forecast
- Returns:
- the forecastJob for jobId with child jobs filled.
 
 - 
getJobsForQueuespublic static List<Long> getJobsForQueues(SchedulerSession session, List<Long> queueIds, DateTimeZone jobsFrom, DateTimeZone jobsTo, boolean includeMaintenanceJobs) throws com.redwood.scheduler.api.exception.SchedulerAPIException A helper function for a request to forecast the jobs in a set of queues where the scheduled start time of the jobs are in a certain time range. For each job group, only one job is added to the list.- Parameters:
- session- to execute the query in
- queueIds- are the uniqueIds of the queues which jobs must be forecast
- jobsFrom- optional start of the time range for the jobs
- jobsTo- optional end of the time range for the jobs
- includeMaintenanceJobs- is true if the maintenance jobs must be forecast as well; if false, the maintenance jobs will be excluded from the result
- Returns:
- a list of jobUniqueIds that must be forecast
- Throws:
- com.redwood.scheduler.api.exception.SchedulerAPIException- if errors are encountered while computing the list of jobs.
 
 - 
getJobsForProcessServerspublic static List<Long> getJobsForProcessServers(SchedulerSession session, List<Long> processServerIds, DateTimeZone jobsFrom, DateTimeZone jobsTo, boolean includeMaintenanceJobs) throws com.redwood.scheduler.api.exception.SchedulerAPIException A helper function for a request to forecast the jobs in a set of process servers where the scheduled start time of the jobs are in a certain time range. For each job group, only one job is added to the list.- Parameters:
- session- to execute the query in
- processServerIds- are the uniqueIds of the process servers which jobs must be forecast
- jobsFrom- optional start of the time range for the jobs
- jobsTo- optional end of the time range for the jobs
- includeMaintenanceJobs- is true if the maintenance jobs must be forecast as well; if false, the maintenance jobs will be excluded from the result
- Returns:
- a list of jobUniqueIds that must be forecast
- Throws:
- com.redwood.scheduler.api.exception.SchedulerAPIException- if errors are encountered while computing the list of jobs.
 
 - 
getJobsForRelatedEntitypublic static List<Long> getJobsForRelatedEntity(SchedulerSession session, String entityType, List<Long> entityIds, DateTimeZone jobsFrom, DateTimeZone jobsTo, boolean includeMaintenanceJobs) throws com.redwood.scheduler.api.exception.SchedulerAPIException A helper function for a request to forecast the jobs in a set of entities (queues, process servers) where the scheduled start time of the jobs are in a certain time range. For each job group, only one job is added to the list.- Parameters:
- session- to execute the query in
- entityType- object type of the entity
- entityIds- are the uniqueIds of the entities for which jobs must be forecast
- jobsFrom- optional start of the time range for the jobs
- jobsTo- optional end of the time range for the jobs
- includeMaintenanceJobs- is true if the maintenance jobs must be forecast as well; if false, the maintenance jobs will be excluded from the result
- Returns:
- a list of jobUniqueIds that must be forecast
- Throws:
- com.redwood.scheduler.api.exception.SchedulerAPIException- if errors are encountered while computing the list of jobs.
 
 - 
getExceptionspublic Collection<Throwable> getExceptions() Description copied from interface:JobForecastContextGet the exceptions that occurred during forecasting.- Specified by:
- getExceptionsin interface- JobForecastContext
- Returns:
- exceptions that occurred during forecasting.
 
 - 
includeExistingJobspublic boolean includeExistingJobs() Description copied from interface:JobForecastContextAre existing jobs included in the result or only return the forecasts when forecasting the jobs in a job group. Does not apply to forecasting the child jobs of a job.- Specified by:
- includeExistingJobsin interface- JobForecastContext
- Returns:
- the value.
 
 - 
setIncludeExistingJobspublic void setIncludeExistingJobs(boolean newIncludeExistingJobs) Include existing jobs or not.- Parameters:
- newIncludeExistingJobs- new value.
 
 
- 
 
-