Skip to content

Conversation

@warren-jones
Copy link
Contributor

@warren-jones warren-jones commented Oct 24, 2024

CLI section copied from AQ Job Pagination Design.docx:

Az CLI

az quantum job list --location --resource-group --workspace-name

=>

az quantum job list --location --resource-group --workspace-name -- type --provider --target --status --created_after --created_before --job-name --skip --num_of_results

Client update required

The data-plane client files in vendored_sdks were updated after the azure-quantum-python SDK's DP client was updated in SDK PR 652: All the files from azure-quantum-python\azure-quantum\azure\quantum\_client were copied into azure-cli-extensions\src\quantum\azext_quantum\vendored_sdks\azure_quantum

No CLI-specific changes were required, so now the CLI extension and the Quantum Python SDK use identical DP client files, automatically generated with Dataplane Codegen and Typespec.

Note: The CLI wiki How to generate the control-plane and data-plane clients no longer applies to the DP client. The AutoREST/Swagger-based client generation described in the wiki now only applies to the control plane client, but that may also change when the CP client is next updated. No changes to the CP client were made for this PR.

New params for az quantum job list

  • job-type
  • item-type
  • provider-id    Existing parameter on other commands
  • target-id     Existing parameter on other commands
  • status
  • created-after   Hyphenate param names for style consistency, rather than underscore
  • created-before
  • job-name     Existing parameter on other commands
  • skip
  • top       Changed for simplicity, instead of num_of_results
  • orderby

Required code changes

  • Pass the new params through the list function in job.py
  • Add a with self.argument_context('quantum job list')… block in the load_arguments function in _params.py, with corresponding …_type statements at the top of that function, including help text
  • Change the cf_quantum function in _client_factory.py to accommodate DP client method name and parameter changes
  • Change the parameter lists on the DP client-factory calls to accommodate the new DP client
  • Change the subsequent client method names and parameter lists as needed
  • Modify response formats to restore original CLI functionality

This PR also includes the fix for GitHub Issue 30947: “az quantum job list - unexpected error: TypeError: Profile.get_login_credentials() got an unexpected keyword argument 'resource'”, opened 3/4/2025


Related command

az quantum job list

Other commands affected by the DP client update -- no external changes expected:

az quantum job cancel
az quantum job output
az quantum job show
az quantum job submit
az quantum job wait
az quantum run
az quantum target list
az quantum workspace quotas


General Guidelines

This checklist is used to make sure that common guidelines for a pull request are followed.

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Oct 24, 2024

⚠️Azure CLI Extensions Breaking Change Test
⚠️quantum
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter created_after
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter created_before
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter item_type
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter job_name
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter job_status
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter job_type
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter order
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter orderby
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter provider_id
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter skip
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter target_id
⚠️ 1006 - ParaAdd quantum job list cmd quantum job list added parameter top

@azure-client-tools-bot-prd
Copy link

Hi @warren-jones,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@yonzhan
Copy link
Collaborator

yonzhan commented Oct 24, 2024

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

Hi @warren-jones

Release Suggestions

Module: quantum

  • Please log updates into to src/quantum/HISTORY.rst
  • Update VERSION to 1.0.0b5 in src/quantum/setup.py

Notes

@yonzhan yonzhan requested a review from jsntcy October 25, 2024 01:02
@warren-jones warren-jones changed the title [Draft - Do not merge] [Quantum] Azure CLI leverages paginated jobs [Quantum] Azure CLI leverages paginated jobs Mar 4, 2025
@warren-jones warren-jones marked this pull request as ready for review March 4, 2025 23:39
@kairu-ms kairu-ms merged commit f78f72b into Azure:main Mar 6, 2025
21 of 22 checks passed
Shivani-Msft pushed a commit to danlope/azure-cli-extensions that referenced this pull request Mar 12, 2025
* Temporarily append '.dev1' to version number

* Modified script and generated new data-plane client files

* Remediated runtime errors

* Added pagination params

* Got missing help text to show

* Pass pagination_params as  kwargs to client.list

* Deleted trailing whitespace to satisfy style check

* Deleted experimental script

* Capitalized param names sent to service

* Changed target.py list return client.get_status to client.list

* Adding code to construct a filter query

* Added the _parse_pagination_param_values function

* Added TODO and DEBUG comments in the job.py  list function

* Added code for more filter conditions

* Fixed pylint and flake8 style violations

* Deleted references to skip_token

* Added orderby support

* Added dictionary of job states

* Temporarily added debug print statements

* Removed the State-code table

* Added special handling of --created-before and --created-after

* Restored  comment that didn't need to be changed

* Added debugging code but commented it out before commit

* Modified some debug code

* Removed 'sorted' call in transform_jobs

* Removed 'def creation(job)' in transform_jobs

* Deleted commented-out code

* Changed --jobs-per-page to --top

* Broke out param-formatting methods to facilitate unit testing

* Validates --order param

* Started adding unit tests

* Added tests

* Changed --type to --job-type, added --item-type, and added more tests

* Minor test changes

* Added more tests

* More tests

* Modified _client_factory.py so the DP client could be used as generated

* First stab at using the SDK's client files

* Deleted commented-out code

* Added error handling and more tests

* Added comments

* Revised a comment

* Deleted commented-out code

* Replaced eval with ast.literal_eval

* Added doc link to job list error messages

* Modified params in _client_factory.py

* Revised comments

* Extracted the first page of the response for processing: --top works!

* Modified cf_providers params to work with new DP client

* Added some creds debug code

* Copied more of azure-quantum-python into vendored_sdks

* Deleted commented-out code

* Deleted commented-out code

* added azure_identity and more of the SDK to vendored_sdks

* Switched to target_factory.get_targets() for target list

* Got target and quotas lists working

* Deleted commented-out code

* Removed the Python SDK files from vendored_sdks

* Added test_workspace_quotas

* Moved list-quotas test into test_workspace_create_destroy

* Added a blank line to fix a Flake8 style violation

* Added help examples

* Restore commented-out test

* Got the job list tests working

* Restored the correct output from job submit and job show

* Got 'job cancel' working again

* Fixed 'azdev style' nit-picks

* Deleted commented-out code

* Changed case of 'InputParams' in job_details

* Deleted redundant #s

* SDK PR 652 has been merged: Copied the DP client files out of the SDK into the CLI extension

* Job wait needs to return job.as_dict()

* Modified run to handle job.as_dict() returns from submit and wait

* Restored the version number (deleted the '.dev1' suffix)

* Changed the job_details field names to lower camel case

* Changed the azure.cli.core._profile.Profile.get_login_credentials parameter list - it was breaking the PR checks

* Fixed another PR check: All the new 'az quantum job list' help examples needed -g, -w, & -l params

* Saved new test recordings

* Deleted old recordings and generated all new one

* Added @live_only() to test_targets (for the list cmd)

* Set test_jobs and test_workspace live_only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Quantum az quantum

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants