Skip to content

Add initial implementation to add configuration for healthagent.#57

Open
aditigaur4 wants to merge 2 commits intomainfrom
configuration
Open

Add initial implementation to add configuration for healthagent.#57
aditigaur4 wants to merge 2 commits intomainfrom
configuration

Conversation

@aditigaur4
Copy link
Copy Markdown
Collaborator

  • Add pyyaml to dependencies and defaults.yaml for default config
  • Add a config module for loading/merging default and user config
  • Allow healthmodule to initialize config
  • Intialize config and pass it to all healthmodules.
  • Install defaults.yaml
  • Add health -C cli. show-config option shows the currently loaded config.

- Add pyyaml to dependencies and defaults.yaml for default config
- Add a config module for loading/merging default and user config
- Allow healthmodule to initialize config
- Intialize config and pass it to all healthmodules.
- Install defaults.yaml
- Add health -C cli. show-config option shows the currently loaded config.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial configuration system to healthagent, including packaged defaults, optional user overrides, and a CLI/API pathway to inspect the effective configuration, while plumbing per-module config dictionaries into all registered health modules.

Changes:

  • Add packaged defaults.yaml plus a healthagent.config module to load defaults and merge /etc/healthagent/config.yaml overrides.
  • Initialize configuration during daemon startup, use it to enable/disable modules, and pass module-specific config into each HealthModule.
  • Extend the health client with --show-config to print the daemon’s effective config.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/test_config.py Adds unit tests for deep_merge, load_config, and HealthModule config injection behavior.
pyproject.toml Adds PyYAML dependency and includes defaults.yaml in package data.
healthagent/config.py New config loader + deep merge implementation.
healthagent/defaults.yaml Introduces shipped default configuration (modules list + per-module sections).
healthagent/healthagent.py Loads config at startup, filters enabled modules, passes module config, and serves show_config.
healthagent/healthmodule.py Extends base module constructor to accept/store config.
healthagent/gpu.py Updates constructor signature to accept config and forwards it to base.
healthagent/network.py Updates constructor signature to accept config and forwards it to base.
healthagent/async_systemd.py Updates constructor signature to accept config and forwards it to base.
healthagent/kmsg.py Updates constructor signature to accept config and forwards it to base.
healthagent/process.py Updates constructor signature to accept config and forwards it to base.
healthagent/client.py Adds -C/--show-config and YAML output formatting for effective config.
healthagent/install.py Copies packaged defaults.yaml into /etc/healthagent/ during install.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread healthagent/config.py Outdated
Comment thread healthagent/config.py Outdated
Comment thread healthagent/install.py Outdated
Comment thread healthagent/install.py Outdated
Comment thread healthagent/defaults.yaml Outdated
Comment thread healthagent/healthmodule.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Comment thread healthagent/config.py Outdated
Comment thread healthagent/healthagent.py
Comment thread healthagent/client.py Outdated
Comment thread tests/test_config.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment thread healthagent/defaults.yaml
Comment on lines +205 to +206
module_config = cls.config.get(module_name, {})
instance_obj = instance(reporter=reporter, config=module_config)
Comment thread healthagent/install.py
Comment on lines +9 to +14
# Copy defaults.yaml to /etc/healthagent/ for operator reference
defaults_src = importlib.resources.files("healthagent").joinpath("defaults.yaml")
defaults_dst = os.path.join(etc_dir, "defaults.yaml")
with importlib.resources.as_file(defaults_src) as src_path:
shutil.copy2(str(src_path), defaults_dst)
print(f"Copied defaults.yaml to {defaults_dst}")
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.

2 participants