Make custom remote control commands available in CLI#8489
Make custom remote control commands available in CLI#8489thedrow merged 4 commits intocelery:mainfrom
Conversation
|
@auvipy Here's a draft pull request for fixing #6608, as per your comment there. (It may be a bit more finalized than "proof of concept", though, haha) |
What troubles did you have running the tests locally? |
Thank you for asking! I couldn't get the Docker image to build, using Podman. It fails on this step due to EDIT: I fixed the problem described below.
|
|
The worker in Now on to the problem of why additional command line parameters are being sent when I run all the tests. It is possible to work around this problem by adding |
|
Ok, I see the problem. The # User options
worker.params.extend(ctx.obj.app.user_options.get('worker', []))
beat.params.extend(ctx.obj.app.user_options.get('beat', []))
events.params.extend(ctx.obj.app.user_options.get('events', []))
for command in celery.commands.values():
command.params.extend(ctx.obj.app.user_options.get('preload', []))
I could probably just add |
|
The tests should run now. However, if you define your own
I'm currently leaning towards solution 1. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #8489 +/- ##
==========================================
+ Coverage 87.44% 87.60% +0.16%
==========================================
Files 148 148
Lines 18491 18522 +31
Branches 3156 3164 +8
==========================================
+ Hits 16169 16226 +57
+ Misses 2033 2005 -28
- Partials 289 291 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
auvipy
left a comment
There was a problem hiding this comment.
thanks for handling this and refactoring the old tests. My primary concern here is if we are changing any existing behavior or functionality to implement the new one or fix anything, we need to be very careful about that. Might also need to consider splitting the relevant changes if needed. I will need some time to thoroughly check and review it.
|
This is superimportant for me as my custom inspect/control commands are not working since Celery moved to Click... :( |
|
We are considering it for 5.4 release. Can you try and review it. |
I wish you did have this concern when decision was made to switch to Click... |
Cutting away the context does not remove it. He was referring to the changes of this PR, so it's a bit misleading my friend. The change to Click had its winning arguments at the time, so the most useful attitude now is to just keep moving forward. We do heavily consider meaningful changes but we can't please everyone at the same time so it's better to adjust the expectations instead. |
well, yes we have lot of issues in the implementation TBH, but design wise it was a good move. actually we need to work on making it parity with old features so. so i request having bit more patience and also if you please collaborate in that, that will be really helpful. but thanks for raising the issue. |
|
Hi, I've faced this issue recently. I think I managed to find a relatively simple solution. I think the root cause of the problem is that options obtained from Panel.meta are extracted when the module celery.bin.control is loaded, not when it's used. My idea would be to define a new type, which returns the proper custom control commands dynamically: I hope you still use this idea useful even if this came a bit late. Best regards, |
|
@fekete42 can you open a draft PR, attila? |
Fixes #6608
Description
The
celery inspect COMMANDandcelery control COMMANDCLI subcommands let users run remote commands against any currently running worker. However, you were limited to running the remote control commands that were pre-defined with Celery. Any custom inspect or control commands specified by the user would be rejected.The reason for this is the fact that the Click configuration is done at import-time. The user's custom inspect and control commands had yet to be registered by the time the top-level code in the
celery/bin/control.pymodule was evaluated.This pull request:
--listoption for seeing all available remote control commands of the relevant type, along with their signature and help summaryinspectandcontrolCLI subcommands accept custom remote control command names and the--listoptionI have not been able to find a way to run the tests successfully on my computer, so I'll need to use the GitHub Actions workflow to help me test.