Skip to content

feat(cli): parallel catalog validation and fleet rollup - #123

Open
mimran-khan wants to merge 8 commits into
NVIDIA:mainfrom
mimran-khan:feat/parallel-catalog-workers
Open

feat(cli): parallel catalog validation and fleet rollup#123
mimran-khan wants to merge 8 commits into
NVIDIA:mainfrom
mimran-khan:feat/parallel-catalog-workers

Conversation

@mimran-khan

Copy link
Copy Markdown
Contributor

Fixes #122
Related: #120, #121

This branch includes two catalog features that stack cleanly:

  1. catalog-summary.json ([FEA]: Machine-readable catalog fleet rollup report #120 / feat(cli): write catalog-summary.json after catalog validate #121): fleet rollup after catalog validate
  2. --workers N ([FEA]: Parallel catalog validation with --workers #122): parallel child-process validation for catalogs

--workers defaults to 1 (serial, same per-skill pipeline view as today). Above 1, skills validate in isolated processes with per-skill output dirs under -o. The parent Click context (or sys.argv when launched from the real CLI) is used to rebuild each child validate invocation, so pytest and production entry points both work.

Parallel mode skips the per-skill Rich pipeline view and prints a single fleet scoreboard at the end. Exit code stays nonzero if any skill failed.

If #121 lands first, I can rebase this to workers-only; happy to split either way.

Test plan

  • pytest tests/test_commands.py -k catalog
  • Serial catalog tests still pass with --workers 1 (default)
  • --workers 2 integration test on two fixture skills

Emit a machine-readable fleet rollup at the reports root with per-skill
status, optional severity totals from child JSON reports, and report paths.
Create the output directory when needed so summary writes survive early
skill failures.

Fixes NVIDIA#120

Signed-off-by: mimran-khan <mohammed_imran.khan@outlook.com>
Catalog validate accepts --workers N to run skills in isolated child
processes. Values above 1 skip the per-skill pipeline view and rebuild
per-skill argv from the parent Click context or sys.argv.

Fixes NVIDIA#122

Signed-off-by: mimran-khan <mohammed_imran.khan@outlook.com>
Comment thread src/skillevaluator/cli.py Outdated
Comment thread src/skillevaluator/cli.py Outdated
"""Return the newest per-skill machine-readable report when present."""
if not skill_report_dir.is_dir():
return None
candidates = sorted(skill_report_dir.glob("skillevaluator-output-*.json"), reverse=True)

@chrisknvidia chrisknvidia Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P1] Restrict report discovery to this run. Reusing -o leaves timestamped child JSON in place; if the current child fails before writing a report, this glob selects the old file and copies it into the current entry. Track each job’s newly produced report, or isolate/clean run outputs, before aggregating.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed: each worker tracks reports before and after the run and only aggregates newly written JSON for that job.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is still reachable when the current worker produces no JSON. json_report_name remains absent and the catalog entry falls back to the newest file in the reused per-skill directory, so I reproduced an old successful overall status and severity counts being attached to a current failure. Please pass only a report produced by this worker invocation, or no report, rather than searching historical files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed _latest_skill_json_report fallback; workers only aggregate JSON written for that run.

Comment thread src/skillevaluator/cli.py Outdated
Comment thread src/skillevaluator/cli.py Outdated
Rebuild child argv without dropping positional catalog paths, track fresh per-skill
JSON reports instead of stale files, write catalog-summary.json atomically, and
fix --include-skills forwarding for context fallback.

Signed-off-by: mimran-khan <mohammed_imran.khan@outlook.com>
@mimran-khan

Copy link
Copy Markdown
Contributor Author

Worker argv, stale JSON, atomic summary, and --include-skills fixes are pushed. Ready for re-review.

@chrisknvidia

chrisknvidia commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

@mimran-khan : Re-reviewed at current head a7ea2e7:

  1. Still broken: real CLI worker argv drops option values. _catalog_child_argv_from_sys() now discards every non-flag token, including values such as schema, 95, model names, and paths. A real console run of skillevaluator validate <catalog> --workers 2 --no-llm --no-dedup --checks schema -o <out> exits 1 and reports 0/1 passed. The new CliRunner test passes because it exercises _catalog_child_argv_from_ctx(), not the production sys.argv path.
  2. Still broken: stale JSON is reused when no new JSON is produced. _run_catalog_skill_worker() returns json_report_name=None, but _catalog_skill_entry() treats None as permission to call _latest_skill_json_report(); serial mode also still scans existing output. Reusing -o reproduced current passed: false / reason: validation failed alongside stale overall_passed: true, overall_status: passed, and old severity counts.

The atomic summary writer and --include-skills fixes were independently verified.

Comment thread src/skillevaluator/cli.py Outdated
if params.get("harbor_keep_jobs"):
argv.append("--harbor-keep-jobs")
for fmt in params.get("report_formats") or ("cli",):
if fmt == "cli":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] Do not discard an explicitly selected CLI report here. With report_formats containing only cli, the fallback emits no -r option, so the child treats reporting as implicit and writes HTML plus JSON instead of honoring CLI-only output.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Child argv is rebuilt from Click context now so --checks and --min-score values survive, and -r cli is forwarded when explicitly selected.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Parallel catalog execution still loses real CLI option values, changes explicit CLI-only reporting, and can reuse stale per-skill JSON after a worker produces no report. Focused catalog tests and Ruff/diff checks passed; the single Python 3.12 CI failure is an unrelated flaky NVIDIA bridge socket test. Requesting changes for the reproducible worker-boundary defects in the review threads.

Comment thread src/skillevaluator/cli.py
continue
if arg.startswith("--workers=") or arg.startswith("--output-dir=") or arg.startswith("-o="):
continue
if not arg.startswith("-"):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P1] This drops option values along with the catalog positional. A real --checks quality invocation becomes bare --checks, and --min-score 95 -r json loses both values, so every worker exits 2. The CliRunner tests only exercise the context fallback. Please rebuild from parsed Click parameters or preserve each option's arity instead of filtering every non-option token.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed argv reconstruction from Click context; option values are no longer dropped.

Rebuild child argv from Click params, preserve -r cli when selected, track
per-run JSON in serial catalog mode, and stop attaching stale reports when
no new JSON was produced this run.

Signed-off-by: mimran-khan <mohammed_imran.khan@outlook.com>
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.

[FEA]: Parallel catalog validation with --workers

3 participants