Version 9 Sneak Peak: Automated Tasks

We’ve overhauled automated jobs in version 9, adding a lot of new functionality and polish (and building on powerful web components like Symfony Messenger, if you’re familiar with that).

A demo of this functionality is going to be a lot more interesting than trying to describe why it’s better, so I put together this video.

Let me know what you think!

3 Likes

This looks fantastic, really keen to put this new system to good use!

Is the dashboard based task scheduling all based on cron style syntax, or does it use something else?

PS - how awesome is it to have a forum where a video can be embedded to be discussed!

2 Likes

The dashboard scheduling syntax is based on cron. Basically you scheduler the scheduler daemon to run every minute, and it takes care of running the tasks when they’re supposed to be. It uses GitHub - mtdowling/cron-expression: CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due to parse the cron that you schedule with it.

And yes! I am very happy with the discourse update.

This is what I waited for long time because we needed to develop a batch job to sync something on most of our projects.

@andrew are old jobs compatible or do we have to rewrite old custom job classes we have working in v8?

Other question @andrew If I don’t have access to the command line:

  • Can I still use cron jobs the old-fashioned way from cPanel for instance? And where’s the URL to do that?
  • Can I still set the tasks options when scheduling them to run automatically either through cron or through page visits?

The old-fashioned way, no – the task system doesn’t currently support triggering these via URL. However if you have access to cpanel you can easily change this to just run via the console – concrete/bin/concrete5 and run the appropriate task command like concrete/bin/concrete5 task:generate-sitemap` every night at midnight, instead of whatever wget command you were running.

Also, triggering the task scheduler through visiting the website is no longer supported either, currently. Triggering this by scheduling the scheduler to run every minute is much more reliable.

thank you @andrew And how about websites running custom jobs? Will those be compatible and still run or is there no backward compatibility between the old and new job systems?

Jobs should all continue to work. The c5:job command via CLI will also continue to work, as will the old method of running jobs by hitting the jobs endpoint with a browser or curl or wget. In the long term jobs will be removed and replaced by tasks but not until version 10 at the earliest.