We should make tasks restartable on a regular basis. The first reason why we want that is to periodically verify sites, but it would also be useful for backups (nightly backups) or restore (demo sites).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anarcat’s picture

anarcat’s picture

Title: refresh parameter for tasks » scheduled tasks (refresh parameter)

A better title.

adrian’s picture

not sure how we want this to work or be configurable.

i'm guessing it should just trigger it in normal cron, adding them to the queue.

tstoeckler’s picture

I put together some screenshots with Firebug.
Thoughts?

Anonymous’s picture

Looks like a good start. For the sake of a scheduled task, there should be a 'frequency' option in the new-scheduled-task form to match that which you've put in the queue list.

Also, as an idea, is it worth not only setting a frequency but optionally a static date/time? Think in terms of creating a calendar event. Is this a one-off task to occur at a certain time, or (more likely) should it be a recurring event weekly? etc.

At this point 'how it looks' matters less to me than how the code logic will work behind to ensure that hosting-dispatch can interrogate certain items like this in the queue and whether it is time to execute the task or not. Mainly because that's the hard part :)

bjalford’s picture

What about including these tasks: create platforms (using the make files) and also having a migrate task. This would allow a form of continuous integration?

Steven Jones’s picture

Some thoughts on this:
Basically what we want here is some kind of ability to specify a date and time to execute a task on, and then subsequently (optionally) repeat it to some schedule. The date package provides all of this, we just need to utilise it, here's how it might work:

We store the next time that the specified task should execute, using the data_api provided FAPI elements, of course. We also use the date_repeat API to allow a repeat rule to be created.
We create a hosting queue that processes the scheduled tasks, find ones that should have been executed. We add the tasks to the standard hosting task queue and then if they have a repeat rule then we compute the date and time of the next occurrence, and then store that.

Thoughts?

Steven Jones’s picture

Another random thought:

Should scheduled tasks be ctools exportable, so that for example, there can be a 'default' backup task for all sites hosted by a particular Aegir, but it could be disabled/edited per site. It might get messy, but there is going to be some need for default schedules tasks of some kind I think.

ergonlogic’s picture

Along with scheduled tasks, if we re-implemented site crons as tasks, we would then have scheduling granularity similar to crontab. This could certainly be useful for sites where a cron run could put the server under some pretty heavy load, such as an API site churning through the job queue populated by Grammar Parser.

jackbravo’s picture

subscribe.

ergonlogic’s picture

Version: 5.x-0.2.x-dev » 7.x-3.x-dev
chertzog’s picture

Issue summary: View changes

we could use rules and rules scheduler to handle creating tasks to be run at future dates.

Jon Pugh’s picture

Wow, 7 years!!

I think we definitely need a "verify queue" of some kind.

For servers and sites, Aegir would make a great monitoring tool if it had this feature.

Jon Pugh’s picture

Issue tags: +important
helmo’s picture

I don't think we should invent our own scheduling system ...

Could we leverage rules scheduler or elysia_cron?

Steven Jones’s picture

Assigned: Unassigned » Steven Jones

I'm assigning this ticket to myself and will come up with something in the next few weeks.
Unless someone else was going to do something sooner in which case, un-assign me :)

Steven Jones’s picture

So, some more concrete thoughts about how to implement this:

  • New module 'hosting_scheduled_tasks' providing:
  • New 'scheduled_task' node type
  • Active checkbox on the scheduled task - so that you can stop the scheduling without having to delete
  • One-time checkbox so you can create one-time tasks
  • Crontab text box, inspired by Jenkins so you can specify a proper crontab entry, one per line
  • Radios of some such for selecting the task type to schedule
  • It will need to fake a task arguments form and then store them away somewhere
  • Uses the crontab class from the Jobqueue module or similar to keep track of the 'next' time a scheduled task should run
  • When a scheduled task is run, it will just enqueue a regular task with the specified arguments and compute the next time it should run (if ever)
  • Then in some extension modules:
  • It should provide a nice way to be editing a site and configure a linked scheduled task for running cron/verify periodically
  • It should provide a nice way to be editing a site and configure a linked scheduled task for running backups periodically
  • It should provide a nice UI for running a task at a specific date and time once
colan’s picture

@Steven: Can we make this work with #15? I've used Elysia Cron in the past; it works great, and does at least some of the above. Wouldn't mind knowing your thoughts on using what's already out there.

Jon Pugh’s picture

Title: scheduled tasks (refresh parameter) » Add Hosting Tasks Schedule module
Status: Active » Needs work

I'm finally making this happen for a client.

Stand by.