-
Notifications
You must be signed in to change notification settings - Fork 14
Feature/add supported infra to samples #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds infrastructure validation support, refactors resource cleanup logic, and updates enum usage across the codebase.
- Introduced a
validate_infrastructurefunction with accompanying tests - Refactored and de-duplicated
_cleanup_resourcesimplementation - Migrated
Enumsubclasses toStrEnum - Injected infrastructure validation into sample notebooks
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/python/test_utils.py | Added imports and tests for validate_infrastructure |
| shared/python/utils.py | Introduced _cleanup_resources, removed duplicate, and implemented validate_infrastructure |
| shared/python/apimtypes.py | Converted Enum subclasses to StrEnum |
| samples/load-balancing/create.ipynb | Added supported_infrastructures list and validation call |
| samples/general/create.ipynb | Added supported_infrastructures list and validation call |
| samples/_TEMPLATE/create.ipynb | Provided template slot for supported_infrastructures and validation call |
Comments suppressed due to low confidence (1)
shared/python/utils.py:185
- The code calls
traceback.print_exc()but there is noimport tracebackin this module, which will raise aNameError. Addimport tracebackat the top.
traceback.print_exc()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds infrastructure support to the samples by introducing new tests and functions for validating supported infrastructures. Key changes include:
- Adding tests in tests/python/test_utils.py to verify the new validate_infrastructure functionality.
- Introducing a new _cleanup_resources helper and a proper validate_infrastructure function in shared/python/utils.py.
- Updating enums in shared/python/apimtypes.py to use StrEnum.
- Updating sample notebooks to incorporate and demonstrate the new supported infrastructures pattern.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/python/test_utils.py | Added tests for the new validate_infrastructure function |
| shared/python/utils.py | Added _cleanup_resources and validate_infrastructure, and removed duplicate validation function usage |
| shared/python/apimtypes.py | Updated enum definitions to use StrEnum |
| samples/load-balancing/create.ipynb | Added supported_infrastructures list and validate_infrastructure usage |
| samples/general/create.ipynb | Added supported_infrastructures list and validate_infrastructure usage |
| samples/_TEMPLATE/create.ipynb | Added placeholder for supported_infrastructures and validation call |
Comments suppressed due to low confidence (1)
shared/python/utils.py:183
- The _cleanup_resources function catches all exceptions and then calls traceback.print_exc(), but there is no import statement for the traceback module. Consider importing traceback or removing its usage.
except Exception as e:
| # PRIVATE METHODS | ||
| # ------------------------------ | ||
|
|
||
| def _cleanup_resources(deployment_name: str, rg_name: str) -> None: |
Copilot
AI
May 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function docstring for _cleanup_resources indicates that it raises an Exception on error, but the implementation catches and logs exceptions instead. Update the docstring to reflect the actual behavior.
Resolves #11