Hi everyone,
Build CPS 8.0 M33.104
It all started with not being able to export the job forecast in a csv format. Please let me know if it is possible.
Now i wanted to utilize the JobForecaster class, however i am facing a serious of problems:
My code snippet:
java.util.TimeZone tz = java.util.TimeZone.getTimeZone("PST8PDT"); DateTimeZone begin = new DateTimeZone(tz,2015,3,14,1,0,0,0); DateTimeZone end = new DateTimeZone(tz,2015,3,14,2,0,0,0); JobForecaster jfc = new JobForecaster(); List l = new ArrayList(); l.add(Long.valueOf(50774835)); jcsOut.println(l.size()); Iterator it = jfc.forecastJobs(jcsSession,begine,end,l); while(it.hasNext()) { ForecastJob fcjob = (ForecastJob)it.next(); DateTimeZone estdtz = fcjob.getExpectedStartTime(); DateTimeZone eetdtz = fcjob.getExpectedEndTime(); jcsOut.println(fcjob.getJobDefinition().getName()+","+estdtz.toString()+","+eetdtz.toString()); }
1. as per documentation, List jobUniqueIds is optional, however if i don't pass it, i get the error:
symbol : method forecastJobs(com.redwood.scheduler.api.model.SchedulerSession,com.redwood.scheduler.api.date.DateTimeZone,com.redwood.scheduler.api.date.DateTimeZone)
2. so i created a list and added one element 50774835, which is a unique id of a job that runs every 15 minutes.(above snippet),
Caused by: java.lang.NullPointerException: while trying to invoke the method com.redwood.scheduler.api.model.JobDefinition.getName() of a null object returned from com.redwood.scheduler.api.model.ForecastJob.getJobDefinition()
3. when i removed the jobdefinition part from line 15 above, i am able to print the estimated start time/end time/runtime (i assume in milliseconds), however i do not see an option to validate whether i am forecasting the job i want, because as per the results, the job had an estimated run time of a minutes, however, the average run time of the job is just 6.5 seconds with a standard deviation of 13.5 seconds.
4. that brings to me to my main question, how do forecast all jobs that fall withing a time frame, if i have to pass the list of uniqueids as a mandatory value?
any help is appreciated.
I do understand that forecast is not persisted and resource intensive, but how else can we build a dynamic forecast based on the most latest runtime statistics.
thanks
Nanda