Skip to content

Conversation

@simonkurtz-MSFT
Copy link
Member

Resolves #11

@simonkurtz-MSFT simonkurtz-MSFT requested a review from Copilot May 28, 2025 17:27
@simonkurtz-MSFT simonkurtz-MSFT self-assigned this May 28, 2025
@github-actions
Copy link

github-actions bot commented May 28, 2025

Python 3.12 Test Results

87 tests  +3   87 ✅ +3   1s ⏱️ ±0s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit d13293e. ± Comparison against base commit 4063e69.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 28, 2025

Python 3.13 Test Results

87 tests  +3   87 ✅ +3   0s ⏱️ -1s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit d13293e. ± Comparison against base commit 4063e69.

♻️ This comment has been updated with latest results.

Copy link

Copilot AI left a 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_infrastructure function with accompanying tests
  • Refactored and de-duplicated _cleanup_resources implementation
  • Migrated Enum subclasses to StrEnum
  • 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 no import traceback in this module, which will raise a NameError. Add import traceback at the top.
        traceback.print_exc()

@simonkurtz-MSFT simonkurtz-MSFT requested a review from Copilot May 28, 2025 17:34
Copy link

Copilot AI left a 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:
Copy link

Copilot AI May 28, 2025

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.

Copilot uses AI. Check for mistakes.
@simonkurtz-MSFT simonkurtz-MSFT merged commit af99c4b into main May 28, 2025
7 checks passed
@simonkurtz-MSFT simonkurtz-MSFT deleted the feature/add-supported-infra-to-samples branch May 28, 2025 17:36
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.

[Feature]: Add Supported Infrastructure Architecture Array to each Sample

2 participants