Generate recurring run schedule upfront

Sorry for reposting this here -- Initially posted under System Operations. I will delete the other topic if/once I get a response.

In our framework, for our work object (Program), we have a covered child object (ProgramRun). ProgramRun instances are spawned based on a schedule-like definition specified on the Program. We are using Embed-ScheduledTask-Scheduling and its embedded pyRecurrenceDetails (Data-Event-Recurring) page to store this information and are using the associated sections to gather the info.

We have a requirement to calculate the schedule times for all the runs (or next 10, in case of no end).

We have looked at the scheduled queue functionality (tools.getThread().getQueueManager().getNextExecutionDateTime(tools.getPrimaryPage()) to see if this might help since it also uses the pyRecurrenceDetails property to calculate the next time. The issue with this API method is that
1) it only gives us the next time (off current time)
2) it requires to be run in the context of a System-Queue page

We can probably work around the second restriction (if we have to), but the first one seems to be a deal-breaker since we need all the run times. I did consider calling this method in a loop, but since the Java engine code looks at current time for determining next run time, this won't help us.

We are wondering if other frameworks have done similar things with pre-generating the times for a recurring schedule? If so, what approach was taken?

I understand that I can probably write this via Activities/Functions. However, due to the intricacies that are usually tied with the Scheduling problem, I am hoping for a re-usable OOTB PRPC solution. If none exists, is anyone aware of light-weight 3rd party libraries that might be utilized to achieve this?

Any other comments/insights will also be appreciated.


**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.


Keep up to date on this post and subscribe to comments

July 26, 2016 - 11:38am

Call it in a loop, each time resetting the pyMinimumDateTimeForProcessing and .pyRecurrenceDetails.pyStartDateTime.to the result.

Hope this helps.