-
Notifications
You must be signed in to change notification settings - Fork 40
Description
BackgroundProcess should be a data model that can be used an extended by various things in the system. It requires a Controller and its Parameters. It will be set with the Controller's Response when run. By default, the parent BackgroundProcess runs immediately when a special URL is hit by Cron.
There should be a general user interface to show all BackgroundProcesses owned by a user (or all users if admin); it should show things that have happened and things that are yet to come, with results and all.
Additionally, my application should be able to get at BackgroundProcesses that it has set up, for its own UI and for its own decision making.
BackgroundProcess can decide whether or not to run, but the BackgroundProcessController will touch all processes which do not have a result set and give them a chance to run.
While a process is running, it will have a StartTime set and a null EndTime. When the process is finished, it will have StartTime, EndTime, and Result. If a process has not run yet, all of these will be null. If an error occurred during the run, it should still look like the process ran successfully, but Result should be set to an object that represents the error condition. This end of things is left up to the programmer.
We will offer subclasses to BackgroundProcess that should handle all process scheduling needs:
ScheduledProcess - takes a "not before" timestamp, before which it will not run. We cannot guarantee that a process WILL run at a specific time, but we can guarantee it will not run before X. The System Administrator will have to decide on a good balance for their cron job - the more often it runs, the more exact the "not before" time will be - but running too frequently could create conflicts and accidentally give more system priority to background processes than to actual end-users. We recommend starting at 10 minutes and adjusting from there.
This all needs to be kept in mind while designing other aspects of the system - I would really like to be able to run background processes on a completely different machine than the one that is serving up user data. The StartTime, EndTime, and Result fields can be used as a semaphore.
RepeatingProcess - takes a cron-style frequency specification and runs over and over.
┆Issue is synchronized with this Asana task