-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Set allow_extra_args to True in context_settings of shell and purge commands #8259
Description
Checklist
- [ x ] I have checked the issues list
for similar or identical enhancement to an existing feature. - [ x ] I have checked the pull requests list
for existing proposed enhancements. - [ x ] I have checked the commit log
to find out if the if the same enhancement was already implemented in the
main branch. - [ x ] I have included all related issues and possible duplicate issues in this issue
(If there are none, check this box anyway).
Related Issues and Possible Duplicates
Related Issues
Possible Duplicates
- None
Brief Summary
The pyramid-celery package adds ini and ini-var options to the standard commands. These allow the standard Pyramid ini configuration files to config Celery. With current Celery however, only the worker, beat, and events are able to be hooked into pyramid-celery's approach because those commands are set with.
context_settings={
'allow_extra_args': True
}
See beat for example:
Line 11 in f3a2cf4
| 'allow_extra_args': True |
The shell and purge commands for some reason do not have context_settings and so do not set allow_extra_args. See for example in shell, https://github.com/celery/celery/blob/f3a2cf45a69b443cac6c79a5c85583c8bd91b0a3/celery/bin/shell.py#LL82C1-L117C24
The consequence is that the ini command options cause errors since these are extra and unknown args to these commands. Excluding the ini config casues shell when it comes up to not get the task registration configs and purge isn't able to see queues.
Design
Architectural Considerations
pyramid-celery is on pypi. Allows you to use pyramid .ini files to configure celery and have your pyramid configuration inside celery tasks.
Proposed Behavior
This should not affect Celery functionality, but will allow pyramid-celery to function as expected. See related issue tracked in pyramid-celery here sontek/pyramid_celery#101
Proposed UI/UX
Celery should add context_settings with allow_extra_args,
context_settings={
'allow_extra_args': True
}
to both the shell and purge commands. This will allow projects like pyramid-celery to hook in their own custom configuration options using the recommended (by Celery) celery_app.user_options['preload'].add() and/or celery_app.user_options[option].add() approaches. See here. This will also make shell and purge commands consistent with other commands like worker, beat, and events that already have these settings.
Diagrams
N/A
Alternatives
None