Azure batch 15x migration - #71071
Open
baha-bouali wants to merge 2 commits into
Open
Conversation
Signed-off-by: baha-bouali <baha.bouali2020@gmail.com>
Signed-off-by: baha-bouali <baha.bouali2020@gmail.com>
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.
closes: #66466
related: #67600
azure-batch15.x is a ground-up rewrite of Azure's Python SDK (track 1 → track 2);BatchServiceClientand the old model classes are gone. #66452 cappedazure-batch<15.0.0as a stopgap; #66466 tracks the real migration to lift it.The migration
This PR carries forward @arieleli01212's work from #67600 as-is:
BatchServiceClient→BatchClient, shared-key auth moved toAzureNamedKeyCredential, the renamed model classes (PoolAddParameter→BatchPoolCreateOptions,CloudTask→BatchTask, etc.), the move to the new flat client API, droppingCloudServiceConfiguration/os_family/os_version, and the matching test rewrites.What this PR adds on top
Two commits on top of his 16, kept separate:
1. Rebase onto current
main. One real conflict, indocs/changelog.rst(an unrelated14.0.0entry had landed since). Resolved by keeping it and placing this migration's pending note above it.2. Fix for the identity-auth path, addressing @aaron-y-chen's open review comment(#67600 (review)) on the
# type: ignore[arg-type]next to theBatchClientcredential. The identity-based branch ofget_conn()built anAzureIdentityCredentialAdapter, which subclasses msrest's track-1BasicTokenAuthenticationand doesn't implementget_token()— what azure-core'sTokenCredentialprotocol requires, and whatBatchClientneeds to authenticate.AzureBaseHook.get_token()in this provider already documents this and raisesAttributeErrorfor it. So this path passed every mocked test but would fail against a real account. Switched toget_sync_default_azure_credential(), already used byAzureBaseHookandasb.pyfor this exact purpose, which returns a realDefaultAzureCredentialthat does implementget_token(). Thetype: ignoreis removed; updated the matching test; added a changelog line.Testing
pytest providers/microsoft/azure/tests/unit/microsoft/azure/hooks/test_batch.pypasses.@eladkal asked whether this had been tested against a live account. Since the bug above only shows up once the SDK actually tries to authenticate, I validated it two ways:
1. Credential check (no Azure account needed):
2. Live pool lifecycle against a real Azure Batch account (Azure for Students, Sweden Central), identity-based auth via Azure CLI login, no shared key:
Real HTTP round trips, no mocking:
No
AttributeError: the exact failure mode of the pre-fix code. Test resources were deleted after validation.Was generative AI tooling used to co-author this PR?