Repository navigation
refactor(artifacts): move run artifacts and exporters into nemo_gym/artifacts - #5212
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
37a0195 to
c932a07
Compare
c932a07 to
7e888df
Compare
72e8f91 to
297cc6e
Compare
297cc6e to
18cd273
Compare
18cd273 to
2676245
Compare
2676245 to
2017460
Compare
yaoyu-33
left a comment
There was a problem hiding this comment.
SHIP. Nothing blocking. There are two small inline notes and two items below.
This PR moves the exporters, run artifacts, resolved config and exporter registry into nemo_gym/artifacts/. It also cuts the row keys and run-file names that the exporters read out of rollout_collection, health.types and batch_status, into artifacts/rollout_rows.py and artifacts/run_files.py. That removes four import-linter exceptions; lint-imports is KEPT with 13 ignored imports.
What we checked:
- Renames and splits. Every renamed file and every split definition matches the base apart from import paths (AST comparison). The row keys,
quality_summary.json,rollout_verdicts.jsonlandaggregation_errorare unchanged. - Old paths. Each old module path,
nemo_gym.exporters.<backend>included, and each moved name gives the same object as its new path, andimport_surface.jsonlists all of them. - Exporter loading. The registry's
module:classstrings resolve. Importingnemo_gym,nemo_gym.artifactsorrollout_collectionstill loads neither wandb nor mlflow. - Exporter workers. They are found with
Path(__file__).with_name(...)and launched by file path. No Slurm script or run file records a module path. - Redirects. The
fern/docs.ymlredirects cover all 11 rendered pages in both forms. The PR preview builds navigation frommain, so they can only be exercised after publish. - Servers and agents. They import from the
nemo_gym.artifactspublic API and install nemo-gym editable. Nothing they ship into a sandbox uses a moved path. - CI. No failure comes from this PR.
- The Harbor failures are Docker Hub HTTP 429s.
telemetry/test_propagation.pyandopenai_modelTestRefusedProviderConnectionalready fail from #5206 up.- kilocode is the non-blocking conformance job.
Two small items without an inline thread:
- [PROCESS] #5166 asks each split PR to list the names whose patches stop taking effect. Could the Compatibility section add one line for this split?
- Patches of these names on
nemo_gym.rollout_collectionno longer reach the exporters (BaseExporter._read_rollouts,_aggregation_failure, MLflow_landed),omitted_rolloutsorrollout_health:_rollout_for_export,_strip_capture_payloads,_MODEL_CALL_PAYLOAD_KEYS,NG_FAILURE_CLASS_KEY,NG_NO_PERSIST_KEYandNG_DISPATCH_DRAINED_KEY. The same holds forAGGREGATION_ERROR_KEYonnemo_gym.batch_status. - The line could tell readers to patch
nemo_gym.artifacts.rollout_rowsornemo_gym.artifacts.run_filesinstead. No in-repo test patches them.
- Patches of these names on
scripts/ci/core_unit_tests.sh:24still citestests/unit_tests/test_exporters.py, which now lives attests/unit_tests/artifacts/test_exporters.py.
Notes for other PRs in the stack (not for this PR)
- #5167:
nemo_gym/__init__.py:247routesnemo_gym.<moved module>attribute access through_moved_names.- So
import nemo_gym; nemo_gym.run_artifactswarns from__init__.pyrather than from the caller. - This PR adds four more modules that reach that path; the inline fix here does not cover it.
- So
- #5206: two tests patch a name on a module that no longer looks it up, which is why those tests fail from #5206 up.
tests/unit_tests/telemetry/test_propagation.py:280patchesnemo_gym.utils.server_process.get_nemo_gym_fastapi_num_workers.responses_api_models/openai_model/tests/test_app.py:1253patchesserver_utils.get_global_aiohttp_client.- The client now binds both names in
nemo_gym/client/http_client.py.
Not verified locally: the MLflow and W&B exporters against their real SDKs (CI installs both extras), GPU paths, or real sandboxes.
…rtifacts resolved_config.py, run_artifacts.py and the exporters package move as they are, and run_exporter_registry.py becomes artifacts/exporter_registry.py. Move the private rollout row keys and the export view of a row out of rollout_collection.py into artifacts/rollout_rows.py, and the quality summary, rollout verdict and aggregation error names out of health/types.py and batch_status.py into artifacts/run_files.py. The exporters read these, so they no longer import the rollout collector. Record the four module moves in MOVED_MODULES (exporters as a package) and the split names in MOVED_NAMES. rollout_collection keeps its deprecated CLI entry points and now also serves the moved row names. Rewrite in-repo references with scripts/migrate_imports.py, make the contract's artifacts layer the nemo_gym.artifacts package, drop the four exceptions the split resolves, and redirect the old library reference pages in fern/docs.yml. Regenerate the public API of each layout package that exists here from what non-test code outside nemo_gym imports, and point code outside nemo_gym, tests included, at nemo_gym.<package>. Signed-off-by: Ananth Subramaniam <[email protected]>
What and why
Moves what a run writes and exports into a new
nemo_gym/artifacts/package: run artifacts, the resolved config, the exporter registry, and the exporters. Two small splits go with it, so the exporters stop importing the rollout collector they sit below.Where this PR sits
The stack lands bottom-up; each PR's base is the branch of the PR before it, so each diff shows only that PR's change.
Where the package sits
An arrow means "imports"; each package imports only packages below it. Yellow: created by this PR. Green: created by an earlier PR in the stack. Grey: still to come.
What moves
nemo_gym/exporters/nemo_gym/artifacts/exporters/nemo_gym/run_artifacts.pynemo_gym/artifacts/run_artifacts.pynemo_gym/resolved_config.pynemo_gym/artifacts/resolved_config.pynemo_gym/run_exporter_registry.pynemo_gym/artifacts/exporter_registry.pyrollout_collection:NG_FAILURE_CLASS_KEY,NG_NO_PERSIST_KEY,NG_DISPATCH_DRAINED_KEY,_MODEL_CALL_PAYLOAD_KEYS,_strip_capture_payloads,_rollout_for_exportnemo_gym/artifacts/rollout_rows.pyhealth.types:QUALITY_SUMMARY_FILENAME,ROLLOUT_VERDICTS_FILENAME,QUALITY_SUMMARY_SOURCES_KEYnemo_gym/artifacts/run_files.pybatch_status:AGGREGATION_ERROR_KEYnemo_gym/artifacts/run_files.pyHow to review
One commit. Its changes:
rollout_collection.pyandbatch_status.pyimport back the ones they use.nemo_gym/_moved_paths.py: the four modules (exportersas a package, sonemo_gym.exporters.wandband the others resolve too) and the split names.rollout_collection.pyalready had a module__getattr__for its deprecated CLI entry points. It now also serves the moved row names.health/types.pygains the same__getattr__as the other split modules.scripts/migrate_imports.py.artifactslayer becomes thenemo_gym.artifactspackage, and four exceptions go away: the exporters no longer importrollout_collectionorbatch_status, and the Harbor run summary no longer importshealth.types. 13 remain.fern/docs.ymlredirects the old library reference pages, including each exporter module.tests/unit_tests/artifacts/. Tests that drive the rollout collector stay and move withrollouts/.History of split files
The repository squash-merges, so this PR lands as one commit. Whole-module moves still show as renames. A split file does not: its old path stays with less in it, so the new file starts its own history.
git blame -C -C <new file>follows the moved lines back to the old file, andgit log --followdoes not.Validation
pytest -n 16 tests/unit_tests, also with-W errorfor every moved path and name in this PR. The only failures are environment-specific and unrelated to the move: this machine's hostname resolves to127.0.1.1, which the sandbox host check refuses (the Harbor run summary tests and the benchmark listing test), and two Docker PTY tests.lint-imports.pre-commit runon the changed files.Rollout evidence: N/A. The code moves unchanged; the rollout and export file formats do not change.
Compatibility
nemo_gym.exporters.wandb, keep resolving.collect_rolloutsandaggregate_rolloutsnames onnemo_gym.rollout_collectionkeep their existing warning.nemo_gym.rollout_collectionno longer reach the exporters,omitted_rollouts, orrollout_health:_rollout_for_export,_strip_capture_payloads,_MODEL_CALL_PAYLOAD_KEYS,NG_FAILURE_CLASS_KEY,NG_NO_PERSIST_KEY, andNG_DISPATCH_DRAINED_KEY; nor does a patch ofAGGREGATION_ERROR_KEYonnemo_gym.batch_status. Patchnemo_gym.artifacts.rollout_rowsornemo_gym.artifacts.run_filesinstead.nemo_gym.artifacts.exporters.*. A logging config set onnemo_gymstill covers them.python scripts/migrate_imports.py <paths>.Issue
Part of #5166.