I'm using Google App Engine and I want like to be able to schedule jobs based users' parameters.
I know this can be done with cron jobs, but looks like it does not allow any flexibility from the user's point of view, but it allows only to schedule predefined jobs.
For example, suppose I have a news app where users can subscribe to different topics: I want the admin to be able to decide when to send a summary email, for instance, every day at 8am, and I want him to be able to edit this.
Is there anything that provides this?
You may want to star Issue 3638: Cron jobs to be scheduled programatically
Meanwhile you can write your own implementation: have a generic cron job running periodically (every 1 minute being the finest resolution) and inside that cron job check user-programmed scheduling data persisted somewhere (in the datastore for example) and, if needed, trigger execution of whatever is needed to be executed, either inlined or by enqueueing a task in some task queue.
It's possible to drive the scheduling resolution even under 1 minute, if needed, see High frequency data refresh with Google App Engine
For my debts tracking app DebtsTracker.io I've implemented it manually.
When a user creates a debt record he can specify due date that is stored in an unindexed
DueDate
and indexedReminderDateTime
fields.I have a cron that query records with
ReminderDateTime < today
and sends notifications. Once notification sent theReminderDateTime
is set to null or far future so it's not picked in next cron run. If user hitsRemind me again
I am updating theReminderDateTime
to some date in future (user decides when).If
ReminderDateTime
is closer then cron interval then I simply create I put a task to queue with appropriate delay.This works very well and is very cheap to run.