Tasks & Jobs

I understand that jobs will stop working at one point. However, not happy with Tasks, so would like to use jobs as long as I can as everything worked fine with it.

I do have the problem though that 9.1 gives me an error with job files if I try to install them. Actually just displaying the job install page /dashboard/system/optimization/jobs gives me an error with all files that worked in version 8:

Undefined property: Application\Job\MyJob::$invalid

Gives me an error in /concrete/single_pages/dashboard/system/optimization/jobs.php line 254

 if (!$job->invalid) {

I don’t know why? It’s a clean fresh install. What am I missing? Or is this a bug?

To run a v8 job in v9, the code has to be modified to conform to the v9 jobs interface - the parameters are specified with different classes.

The folks in Japan (Macareux) have published a lot about converting and running jobs in v9.

There is also a package to run jobs as tasks - Github GitHub - MacareuxDigital/md_job_runner: Task to run automated job . Beware that the conversion of jobs section on the github page is specific to the job runner task.

There is also a blog post about converting a job to a task (vs running as a task) Converting Jobs to Tasks | マカルーデジタル

Thank you, but that only explains how to use Tasks instead of jobs and how to switch to it? I’d rather not use a package. It’s just 5 jobs we need to convert. Is anywhere any documentation how jobs in V9 work?

Its very similar to making it compatible with the job runner task, but a another different set of classes in the parameters. You will need to look at the current core source for jobs to identify the classes /concrete/src/Job/QueueableJob.php, or through the early v9 source on github where some old/converted jobs were left in the source. There may be explicit info if you search back far enough in the forums. At the start of v9 there was a v8 to v9 update technical thread.

Beware that queueable jobs will be run as a single request in v9, not split into slices.

To run a queueable job in slices you need to either install the job runner task and change the parameter types as noted, or convert the job to a task.

Thank you John. Seems like a lot of work to go trough just to make a fully fine module (jobs) to still work in v9. We try a different solution that is independent of concrete5, this seems too excessive.

But thanks anyways.

Actually managed to make it work, simply by adding
public $invalid = false;

No idea what invalid does. But for now all jobs work in V9. Yay!

Really hope jobs will stay as legacy as long as possible. Tasks are not intuitive at all, an absolute pain to add a new task and seem to have too many troubles. Hopefully till jobs go away tasks have become as easy to install and handle as jobs.