Lazy Loading for CLI Performance Optimization #241
Closed
mohamedzeidan2021 wants to merge 8 commits intoaws:mainfrom
Closed
Lazy Loading for CLI Performance Optimization #241mohamedzeidan2021 wants to merge 8 commits intoaws:mainfrom
mohamedzeidan2021 wants to merge 8 commits intoaws:mainfrom
Conversation
Collaborator
Author
|
not working correctly after cluster creation launch |
rsareddy0329
pushed a commit
that referenced
this pull request
Sep 23, 2025
* decouple template from src code * update unit tests for init * remove field validator from SDK pydantic model, fix minor parsing problem with list, update kubernetes_version type from str to float * Update pyproject.toml for cluster stack template to include json, update read_only to be boolean * change type handler from class to module functions, change some public function to private, update unit tests * update create for pytorch job template, remove redundant integ test code for init
rsareddy0329
pushed a commit
that referenced
this pull request
Sep 24, 2025
* decouple template from src code * update unit tests for init * remove field validator from SDK pydantic model, fix minor parsing problem with list, update kubernetes_version type from str to float * Update pyproject.toml for cluster stack template to include json, update read_only to be boolean * change type handler from class to module functions, change some public function to private, update unit tests * update create for pytorch job template, remove redundant integ test code for init
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.
These changes introduce a lazy loading system that improves the HPCLI startup performance. Dependencies are no longer loaded upfront (resulting in 2+ second startup time) and are now loaded only when needed, reducing the help command times by 50% while maintaining full functionality during execution.
Architecture
1. LazyImportManager
Replaces traditional imports with a config based system the defers heavy modules until they're accessed. Integrates with
__getattr__Python mechanism2. LazyRegistry
Provides lightweight substitutes for heavy registries during CLI generation. The flow now stores basic metadata for immediate CLI option generation, and defers full schemas until commands are actually executed and need validation
3. LazyDecorator
Applies decorators based on current needs from the system. For example - immediately applies for CLI generation decorators (needed for help text), and deferred application for runtime decorators (telemetry, logging) that are ONLY needed during command execution
4. CommandRegistry
Removes the need for hardcoded command mappings by enabling commands to self-register with metadata during imports. This allows the CLI to discover available commands without loading heavy modules/deps; selects which modules to load based on which commands users actually run.
How they all work together
These components form the pipeline as such:
Example
hyp create hyp-pytorch-job --help!hyp create hyp-jumpstart-endpoint --model-id deepseek-llm-r1-distill-qwen-1-5b --instance-type ml.g5.8xlarge --endpoint-name new-endpointPR Approval Steps
For Requester
For Reviewer
For Requestersection to double check each item.