Repository navigation
feat: collect system metadata and requirements on start - #1528
Merged
Merged
Conversation
On Run startup, collect system environment and hardware info via system.new(), write metadata/requirements/conda files with safe_write and emit corresponding events (MetadataEvent, RequirementsEvent, CondaEvent). Move background consumer start to after initial collection and bind config as before. Add system module that aggregates git/runtime/conda/requirements and hardware (Apple/CPU/Memory) into a SystemEnvironment, and provide MetadataSnapshot.del_hardware to drop hardware when disabled. Make vendor get() methods static and update protocol typings accordingly. Harden requirements detection by using _try_run to handle missing executables and raise if no method succeeds.
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements system information and hardware metadata collection during run initialization, introducing new event types for Conda, Metadata, and Requirements. It refactors hardware vendor classes to use static methods and enhances the environment requirement gathering process. Review feedback suggests optimizing timestamp object reuse and utilizing Pydantic's model_copy for cleaner object updates.
Add typing.Optional import and replace the PEP 604 union annotation with Optional[subprocess.CompletedProcess] for the _try_run return type. This preserves compatibility with Python versions that don't support the '|' union operator and does not change runtime behavior.
Avoid repeated Timestamp instantiation in run initialization by reusing a single Timestamp when emitting metadata/requirements/conda events. Update MetadataSnapshot.del_hardware to use model_copy(update={"hardware": None}) (Pydantic v2-friendly and respects frozen config). Remove an unused test package init and add a comprehensive end-to-end test suite for system hardware collection covering platforms, settings gating, error handling, and data consistency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
接入系统信息采集