Skip to content

refactor: consolidate scripts/tests and clean up defensive programming - #33

Merged
kaiwenKevinn merged 2 commits into
mainfrom
refactor/repo-and-defensive-cleanup
Nov 25, 2026
Merged

kaiwenKevinn merged 2 commits into
mainfrom
refactor/repo-and-defensive-cleanup

Conversation

@kaiwenKevinn

Copy link
Copy Markdown
Collaborator

Summary

This PR prepares Libra as a cleaner, easier-to-adopt research baseline by removing obsolete one-off cluster scripts, redundant tests/examples, dead NPU/HCCL code, and redundant defensive boilerplate.

1. Repository & Test Consolidation

  • Removed obsolete scripts (scripts/): Deleted 40 site-specific .slurm, zombie cleanup, probe, and ad-hoc helper scripts while keeping core analysis, serving, preflight, and CPU CI scripts.
  • Removed redundant examples & stale configs: Removed 21 legacy examples/test_* / validation scripts (keeping 6 core workflow entrypoints) and 10 obsolete cluster-specific YAML configs; fixed configs/dapo_math_cmlfq_qwen3_4b.yaml model_arch_config path.
  • Consolidated CPU CI test suite (tests/ & scripts/test_cpu_ci.sh): Merged test_qwen3_config.py into tests/test_config_parsing.py, removed 69 redundant test files, simplified scripts/test_cpu_ci.sh to run pytest over tests/ (20 core test files), added tests/conftest.py for local editable import resilience, and quoted executable paths in subprocess tests (test_global_resource_planner_simulators.py, test_preflight_planner.py).
  • Updated docs/ci.md.

2. Defensive-Programming Cleanup

  • Removed dead NPU/HCCL branches in trainer/async_rl_trainer.py (torch.npu.*, silent fallback exceptions), standardizing on torch.cuda.is_available().
  • Removed redundant getattr/hasattr calls on strongly-typed dataclasses (AsyncRLConfig, GlobalResourcePlannerConfig, HeterogeneousRolloutConfig, ResourceConfig) and initialized self.* attributes across config.py, trainer/async_rl_trainer.py, engine/heterogeneous_engine.py, infra/elastic/runtime_executor.py, infra/elastic/rollout_lending.py, infra/elastic/rollout_lifecycle.py, infra/cost_model/global_resource_planner.py, infra/cost_model/simulator_adapters.py, and infra/observability/history_collector.py.
  • Narrowed silent exception catches on JSON control-dir polling and health HTTP checks to specific (OSError, json.JSONDecodeError) / (OSError, urllib.error.URLError).
  • Removed SimpleNamespace config mocks in tests/test_ehp_batch_partition.py and tests/test_grpo_grouping.py in favor of real AsyncRLConfig and GlobalResourcePlannerConfig.

Verification

  • bash scripts/test_cpu_ci.sh: 249 passed in 20.12s (0 failed, 0 skipped).

@kaiwenKevinn
kaiwenKevinn merged commit 37751d9 into main Nov 25, 2026
4 of 5 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.

1 participant