Repository navigation
Quantum: Make storage account optional for workspace creation - #10478
v-elegacheva wants to merge 5 commits into
Conversation
|
Thank you for your contribution v-elegacheva! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues in the focused creation-path changes and accompanying coverage; tests were not run.
0 open findings
What changed in this PR
Makes storage optional when creating Azure Quantum workspaces, allowing Azure Quantum to provision managed storage.
Changes:
- Adds managed-storage creation while preserving explicit storage support.
- Updates help examples and adds unit and live-scenario coverage.
- Bumps the extension to
1.0.0b31.
| File | Description |
|---|---|
src/quantum/setup.py |
Bumps the extension version. |
src/quantum/HISTORY.rst |
Documents optional storage. |
src/quantum/azext_quantum/tests/latest/test_quantum_workspace.py |
Adds managed-storage tests and updates polling assertions. |
src/quantum/azext_quantum/operations/workspace.py |
Allows omitted storage and waits for managed-storage creation. |
src/quantum/azext_quantum/_params.py |
Explains the managed-storage default. |
src/quantum/azext_quantum/_help.py |
Updates workspace creation examples. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return quantum_workspace | ||
| if not storage_account: | ||
| poller = client.begin_create_or_update( | ||
| info.resource_group, info.name, quantum_workspace |
There was a problem hiding this comment.
when storage name is specified - we set polling=False, but otherwise not, can we use same pattern for both?
There was a problem hiding this comment.
Got it! Updated for both
There was a problem hiding this comment.
still not addressed
There was a problem hiding this comment.
Oh, I combined the calls but left polling= not storage_account. I changed that to polling = False for both direct api creation cases
| # Until the "--skip-role-assignment" parameter is deprecated, use the old non-ARM code to create a workspace without doing a role assignment | ||
| if skip_role_assignment: | ||
| # Use direct API creation when storage is service-managed or role assignment is explicitly skipped. | ||
| if skip_role_assignment or not storage_account: | ||
| _add_quantum_providers(cmd, quantum_workspace, provider_sku_list, auto_accept, skip_autoadd) | ||
| _apply_target_quotas(quantum_workspace.properties.providers, quota) |
There was a problem hiding this comment.
while we are here can we improve this to call v2 related methods only for v2 workspace, like:
if workspace_kind_value == WorkspaceKind.V2.value:
_apply_target_quotas(quantum_workspace.properties.providers, quota)
_validate_target_quota_bounds(cmd, info, quantum_workspace, quota, include_usage=False)
quantum_workspace.properties.workspace_kind = WorkspaceKind.V2
quantum_workspace.properties.api_key_enabled = False
and we probably don't need else here as we probably can skip setting api_key_enabled (check in backend)
There was a problem hiding this comment.
and I think we have some of the code duplicate later, so we could just call it once
There was a problem hiding this comment.
Got it! Also for removing of the else statement: looks like omitting apiKeyEnabled on a create-or-update request disables api keys for an existing v1 workspace (but it defaults to true for a new one). So I kept the = True assignment to preserve existing behavior
| f'az quantum workspace create --auto-accept --skip-autoadd ' | ||
| f'-g {test_resource_group} -w {test_workspace} ' | ||
| f'-l {test_location} -r "{test_provider_sku_list}" -o json', | ||
| checks=[self.check('properties.provisioningState', 'Succeeded')] |
There was a problem hiding this comment.
it can take some time to be fully provisioned, can you use same waiting pattern that we have in other tests?
| ('workspace defaults', 'az quantum workspace clear') | ||
| ) | ||
| run_cleanup_commands(self, cleanup_commands) | ||
|
|
||
| def test_workspace_v2_create_destroy(self): |
There was a problem hiding this comment.
can you create additional test to test v2 workspace creation without specifiying storage account instead modifiying test that we need to test with user specified storage account
There was a problem hiding this comment.
please make sure we cover e2e the following scenarios:
- v1 workspace creation with user provided storage account
- v1 workspace creation without provided storage so we will create managed storage account
- v2 workspace creation with user provided storage account
- v2 workspace creation without provided storage so we will create managed storage account ouselves
There was a problem hiding this comment.
Got it! All 4 scenarios passed in local live (had to increasing the provisioning-wait budget a little bit because the case with V1 supplied-storage took a little longer)
There was a problem hiding this comment.
rename tests accordingly: *_with_managed_storage, *_with_user_storage
There was a problem hiding this comment.
Tests have been renamed to contain with_managed_storage or with_user_storage
| - name: Create a new Azure Quantum workspace with a specific storage account. | ||
| text: |- | ||
| az quantum workspace create -g MyResourceGroup -w MyWorkspace -l MyLocation \\ | ||
| --storage-account MyStorageAccountName |
There was a problem hiding this comment.
use short version for storage account parameter as you are using for other params here
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
| ]) | ||
|
|
||
| time.sleep(10) # Wait for the workspace to be provisioned | ||
| _wait_for_workspace_provisioned(self, test_resource_group, test_workspace_temp, attempts=MANAGED_STORAGE_PROVISIONING_ATTEMPTS) # Wait for the workspace to be provisioned |
There was a problem hiding this comment.
MANAGED_STORAGE_PROVISIONING_ATTEMPTS is now also used for the --skip-role-assignment case, which uses your own storage. A more general name would fit better.
There was a problem hiding this comment.
Got it, renamed it WORKSPACE_PROVISIONING_ATTEMPTS
| self.cmd(f'az quantum workspace create --auto-accept -g {test_resource_group} -w {test_workspace_temp} -l {test_location} -a {test_storage_account} -r {test_provider_sku_list} -o json --skip-role-assignment', checks=[ | ||
| self.check("name", test_workspace_temp), | ||
| self.check("properties.provisioningState", "Accepted") # Status is accepted since we're not linking the storage account. | ||
| self.check("properties.provisioningState", "Accepted") # Accepted because --skip-role-assignment returns without waiting. |
There was a problem hiding this comment.
update test name to reflect that it tests v1 creation with user specified storage
There was a problem hiding this comment.
Scenario 1 (V1 with your own storage account) checks too little. The existing test only confirms the deployment name. It doesn't check that the workspace is linked to that storage account. The V2 test does check this, so the same assertion could be copied over.
There was a problem hiding this comment.
Test has been renamed. And I added _assert_user_storage() after provisioning in each v1 user-storage subcase. It verifies that the workspace is linked to the expected storage account and that managed stage is absent. V2 uses same helper
| self.assertTrue(properties.get('managedStorageAccount')) | ||
| self.assertFalse(properties.get('storageAccount')) | ||
|
|
||
| def test_workspace_v1_create_destroy_without_storage_account(self): |
There was a problem hiding this comment.
better name: test_workspace_v1_create_destroy_with_managed_storage
for cases when user specified storage: test_workspace_v1_create_destroy_with_user_storage
There was a problem hiding this comment.
Updated both names
| ) | ||
|
|
||
| TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) | ||
| MANAGED_STORAGE_PROVISIONING_ATTEMPTS = 60 |
There was a problem hiding this comment.
why this is 60?
There was a problem hiding this comment.
The v1 case with provided storage needed 31 checks (~6.5 minutes) before the provisioning succeeded. I increased the checks to 60 to allow headroom for slower runs. This allows roughly 11 minutes of waiting + command execution time
| quantum_workspace = poller.result() | ||
| return quantum_workspace | ||
|
|
||
| if skip_role_assignment or not storage_account: |
There was a problem hiding this comment.
--skip-role-assignment is ignored without -a. It's silently ignored, and its help text hasn't changed.
There was a problem hiding this comment.
I added validation to reject --skip-role-assignment when -a is omitted, since roles are managed automatically by azure quantum when no storage is provided by user
🤖 PR Validation —⚠️ Review suggested
Summary
Make
--storage-accountoptional foraz quantum workspace create.Changed
--skip-role-assignment.Testing