server
server copied to clipboard
Allow calling cron jobs background job class with occ
This would allow important jobs to be handled in a separate cronjob execution, so they can get executed, even if other jobs have lined up before
e.g. have a separate cron job with php occ background-job:worker OCA\\Files\\BackgroundJob\\ScanFiles
Might be something related to https://github.com/nextcloud/server/issues/29204 to have also an occ command to run individual job classes in addition to the list. This would be similar to how Laravel handles queues https://laravel.com/docs/8.x/queues some further things to think about:
- group multiple classes by their domain/importance
- have a worker occ command that could be setup as a continuous runner
This can also help in this cases: https://github.com/nextcloud/server/issues/30273
we already have background-job:execute but I heard it doesn't work for all types and requires a job id, not a class name
Sounds like a good idea to rather implement it as an occ which people could still setup as a cron job then.
- [ ] tests
Please rebase :)
Rebased on master, made a few minor changes, added -h option to cron.php, more output in the background job worker. Tested the background job worker, LGTM. This will greatly help to improve the user experience when running data processing tasks like text processing, speech-to-text etc...
Would it be possible to pass a list of job classes to run? That way we can avoid overloading a GPU (if there's only one) with tasks from multiple different background job daemons
@marcelklehr Nice idea, I added it in this PR for both cron.php and the occ background-job:worker
command.
Anything else we should add/change before making this ready for reviews?
Still stale @julien-nc ? Please adjust labels :)
Thanks @marcelklehr and @julien-nc for picking this one up. 🚀