Skip to content

Conversation

@AlanCoding
Copy link
Member

@AlanCoding AlanCoding commented Dec 9, 2025

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 dispatcherctl so that it is aware of the level option, which require refactoring control task generally to allow structured extraction of expected parameters in data that gets passed in to control tasks.


Note

Adds a set_log_level control task and refactors the CLI to subcommands with auto-registered args parsed from control task docstrings; updates demo and adds tests.

  • Control Tasks:
    • Add set_log_level to change the dispatcherd logger level at runtime, with validation and status response.
    • Update status to skip set_log_level.
    • Add docstring "Control Args" schemas to running, cancel, aio_tasks, and set_log_level.
  • CLI:
    • Refactor to subcommand-based control entrypoint using argparse subparsers.
    • Auto-generate command options from docstring YAML schemas; add helpers to parse schemas and build data.
    • Add shared parents for --log-level, --config, and --expected-replies.
  • Demo:
    • Demonstrate dynamic log level changes via set_log_level before/after task bursts.
  • Tests:
    • Add unit tests for control arg schemas, CLI data building/entrypoint, and set_log_level behavior (valid/invalid levels, int levels).

Written by Cursor Bugbot for commit c9eca64. This will update automatically on new commits. Configure here.

@AlanCoding AlanCoding marked this pull request as ready for review December 9, 2025 21:22
@AlanCoding AlanCoding requested a review from hsong-rh December 9, 2025 21:32
@AlanCoding AlanCoding changed the title Allow dynamically configuring the dispatcherd log level AAP-60452 Allow dynamically configuring the dispatcherd log level Dec 10, 2025
Connect the options to specific control commands

Use marker to get around slice issue

Remove args when there are none

Add test
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 11, 2025

@AlanCoding AlanCoding merged commit 86a1c1b into ansible:main Dec 11, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants