Skip to content

Allow --system-config to be set via CLOUDAI_SYSTEM_CONFIG env var - #986

Open
shreyaskommuri wants to merge 1 commit into
NVIDIA:mainfrom
shreyaskommuri:issue/system-config-env-var
Open

Allow --system-config to be set via CLOUDAI_SYSTEM_CONFIG env var#986
shreyaskommuri wants to merge 1 commit into
NVIDIA:mainfrom
shreyaskommuri:issue/system-config-env-var

Conversation

@shreyaskommuri

@shreyaskommuri shreyaskommuri commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • --system-config can now be set via a CLOUDAI_SYSTEM_CONFIG environment variable instead of always passing the flag explicitly.
  • The --system-config flag still takes precedence when both are set. The requirement that one of them is provided is unchanged (click's envvar= mechanism satisfies required=True).
  • Suggested by @podkidyshev as a small quality-of-life improvement while discussing the parser work tracked in Support relative-path test references and lazy-load only referenced test/hook tomls #985.
  • Change is a single option definition in src/cloudai/cli/cli.py's common_options, so it applies to install, uninstall, dry-run, run, and generate-report uniformly. verify-configs does not use --system-config and is unaffected.

Test Plan

Added 3 tests to tests/test_cli.py: env-var-only resolution, flag-takes-precedence-over-env-var, and env var documented in --help across all 5 subcommands.

$ uv run pytest tests/test_cli.py -v
...
tests/test_cli.py::test_system_config_can_be_set_via_env_var PASSED
tests/test_cli.py::test_system_config_flag_takes_precedence_over_env_var PASSED
tests/test_cli.py::test_system_config_env_var_documented_in_help[install] PASSED
tests/test_cli.py::test_system_config_env_var_documented_in_help[uninstall] PASSED
tests/test_cli.py::test_system_config_env_var_documented_in_help[dry-run] PASSED
tests/test_cli.py::test_system_config_env_var_documented_in_help[run] PASSED
tests/test_cli.py::test_system_config_env_var_documented_in_help[generate-report] PASSED
...
39 passed in 0.05s

Also ran a real end-to-end dry-run using the env var instead of the flag, against the bundled sleep scenario:

$ CLOUDAI_SYSTEM_CONFIG="$(pwd)/conf/common/system/standalone_system.toml" uv run cloudai dry-run \
    --tests-dir conf/common/test \
    --test-scenario conf/common/test_scenario/sleep.toml
...
[INFO] Scenario results
╔════════════════╤════════╤════════════════════════════════════════════════════╗
║ Case           │ Status │ Details                                            ║
╟────────────────┼────────┼────────────────────────────────────────────────────╢
║ Tests.sleep1   │ PASSED │ results/.../Tests.sleep1/0                         ║
║ Tests.sleep5   │ PASSED │ results/.../Tests.sleep5/0                         ║
║ Tests.sleep5_2 │ PASSED │ results/.../Tests.sleep5_2/0                       ║
║ Tests.sleep20  │ PASSED │ results/.../Tests.sleep20/0                        ║
╚════════════════╧════════╧════════════════════════════════════════════════════╝
[INFO] All jobs are complete.

Also ran full suite (uv run pytest -q, 1806 passed), ruff check, ruff format --check, and pyright, all clean.

Additional Notes

None.

Copilot AI review requested due to automatic review settings July 29, 2026 18:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: a2926891-64bd-4b98-ad40-5348c9149dac

📥 Commits

Reviewing files that changed from the base of the PR and between 46433aa and 95836dd.

📒 Files selected for processing (2)
  • src/cloudai/cli/cli.py
  • tests/test_cli.py

📝 Walkthrough

Walkthrough

The shared --system-config CLI option now supports CLOUDAI_SYSTEM_CONFIG, with tests covering environment configuration, explicit option precedence, and help output.

Changes

System config environment support

Layer / File(s) Summary
Add environment-backed system config option
src/cloudai/cli/cli.py
The shared --system-config option accepts CLOUDAI_SYSTEM_CONFIG and documents it in the help text.
Validate CLI configuration behavior
tests/test_cli.py
Tests cover environment-based configuration, explicit option precedence, and help documentation across subcommands.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: srivatsankrishnan

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: sourcing --system-config from CLOUDAI_SYSTEM_CONFIG.
Description check ✅ Passed The description directly matches the implemented CLI env-var support, precedence behavior, and added tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Suggested by a maintainer as a small quality-of-life improvement while
discussing parser work. Falls back to the env var only when
--system-config isn't passed explicitly; the flag still takes
precedence.

Signed-off-by: shreyaskommuri <shreyaskommuri@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_cli.py`:
- Around line 49-60: Strengthen test_system_config_can_be_set_via_env_var so it
asserts the expected downstream configuration-validation error produced from
system_cfg, rather than only checking that the missing-option message is absent.
Include system_cfg’s path in the assertion when that path is exposed in the CLI
output, proving CLOUDAI_SYSTEM_CONFIG was actually used.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 853c4d21-40ba-4004-8d4d-8931d6da0abc

📥 Commits

Reviewing files that changed from the base of the PR and between bd8332f and 46433aa.

📒 Files selected for processing (2)
  • src/cloudai/cli/cli.py
  • tests/test_cli.py

Comment thread tests/test_cli.py
@shreyaskommuri
shreyaskommuri force-pushed the issue/system-config-env-var branch from 46433aa to 95836dd Compare July 29, 2026 18:49
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