AAP-60452 Allow dynamically configuring the dispatcherd log level #197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to ansible/awx#16200
This adds a control task that allows setting the log level of the "dispatcherd" logger. This might be somewhat tricky, because we don't want to make any assumptions that this even if configured. But if you run the command, we set a level for the logger. If you don't like it, you can set it to a new value. But dispatcherd as a library still won't mess with your logging if you don't run this command. This strikes me as a fair balance.
Because related to the AWX PR, we do kind of need a mechanism to on-the-fly change the logging level of the main process, and this can be accomplished by a simple broadcast_all extra call via this new command. I'm fairly satisfied with this solution.
As of creating this PR, still debugging the CLI entrypoint specifically of
dispatcherctlso that it is aware of the level option, which require refactoring control task generally to allow structured extraction of expected parameters indatathat gets passed in to control tasks.Note
Adds a
set_log_levelcontrol task and refactors the CLI to subcommands with auto-registered args parsed from control task docstrings; updates demo and adds tests.set_log_levelto change thedispatcherdlogger level at runtime, with validation and status response.statusto skipset_log_level.running,cancel,aio_tasks, andset_log_level.controlentrypoint usingargparsesubparsers.data.--log-level,--config, and--expected-replies.set_log_levelbefore/after task bursts.set_log_levelbehavior (valid/invalid levels, int levels).Written by Cursor Bugbot for commit c9eca64. This will update automatically on new commits. Configure here.