Description
This issue is automatically created based on existing pull request: #34117: Add --exclude-group to cron:run
Description
When you decide to split a single cron group with the --group
flag it means you need to do so for every group in your instance.
It's pretty common for third party modules to define their own groups whenever they like, so we have to keep up to date with the defined groups in the instance to keep adding these to our crontab when new groups are added.
One of my instances currently has 11 groups to manage, more will come in the future and its just something I need to mentally keep an eye on, a bit annoying.
In my case I only really want to run the crons like
* * * * * bin/magento cron:run --exclude-group index
* * * * * flock -n index.lock bin/magento cron:run --group index
This will give me better granular control over the indexer crons which can be useful when your store reaches hundreds of thousands of SKUs. Any other random cron groups would then still be able to run by default like in normal operation.
For future proofing I've made the --exclude-group
flag stackable so you can define it multiple times like
* * * * * bin/magento cron:run --exclude-group index --exclude-group consumers
Manual testing scenarios (*)
- Run cron with no params, all groups run
- Run cron with --group, only that group runs
- Run cron with --group and that group also in --exclude-group, no groups run
- Run cron with --exclude-group, that group is excluded
- Run cron with multiple --exclude-group, all defined groups are excluded
Contribution checklist (*)
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- All new or changed code is covered with unit/integration tests (if applicable)
- README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
- All automated tests passed successfully (all builds are green)