Skip to content

Add update job operation to support updating name, priority and tags - #764

Open
v-elegacheva wants to merge 3 commits into
microsoft:mainfrom
v-elegacheva:ekaterina/job-update-on-main
Open

Add update job operation to support updating name, priority and tags#764
v-elegacheva wants to merge 3 commits into
microsoft:mainfrom
v-elegacheva:ekaterina/job-update-on-main

Conversation

@v-elegacheva

@v-elegacheva v-elegacheva commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds support for updating a submitted job's name, priority, and/or tags to the Python SDK, implementing the SDK side of the merged Data Plane API Spec. Only the fields you provide are sent, and the updated job is returned. Note: tags replaces existing tags rather than appending.

What Changed

  • Added Workspace.update_job(job, *, name=None, priority=None, tags=None).
  • Added the Job.update(...) instance method, which updates the job in place.
  • Requires at least one field (name, priority, or tags); raises ValueError otherwise.
  • Exposed the Priority enum (Standard / High) publicly.
  • Added unit tests and mock client support.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Ready to approve

The implementation aligns with the generated client’s merge-patch update API and includes targeted unit tests, with only minor doc/test-surface nits noted.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Adds an update capability for already-submitted Azure Quantum jobs, enabling callers to change a job’s name, priority, and/or tags via JSON Merge Patch, with supporting public API exposure and tests.

Changes:

  • Introduces Workspace.update_job(...) to patch job name/priority/tags (requiring at least one field).
  • Adds Job.update(...) convenience method to update a job and refresh its details in place.
  • Extends the test mock client and adds unit tests covering success, partial updates, and error cases.
File summaries
File Description
azure-quantum/tests/test_workspace.py Adds unit tests validating job update behavior and error handling.
azure-quantum/tests/mock_client.py Adds mock jobs.update(...) implementation to support tests.
azure-quantum/azure/quantum/workspace.py Implements Workspace.update_job(...) using JobUpdateOptions merge-patch.
azure-quantum/azure/quantum/job/job.py Adds Job.update(...) wrapper calling Workspace.update_job(...).
azure-quantum/azure/quantum/init.py Exposes Priority on the public azure.quantum package namespace.
.gitignore Ignores a local scratch/manual test file.
Review details
  • Files reviewed: 5/6 changed files
  • Comments generated: 2
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.


:param priority:
The new priority of the job.
One of :class:`~azure.quantum.Priority` (``\"Standard\"`` or ``\"High\"``).
Comment thread azure-quantum/tests/test_workspace.py Outdated
from unittest import mock
from azure.quantum.job.job import Job
from azure.quantum._client.models import JobDetails
from azure.quantum._client.models import Priority
Adds Workspace.update_job and Job.update to update a submitted job's name, priority and/or tags via the JobUpdateOptions JSON Merge Patch operation. Only provided fields are sent; requires at least one field. Exposes Priority publicly and adds unit tests plus mock client support.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Not ready to approve

The public API exposure of Priority isn’t actually validated by the new tests, and there’s a docstring escaping issue that will render incorrectly in generated documentation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Review details

Suppressed comments (2)

azure-quantum/azure/quantum/workspace.py:493

  • The docstring escapes quotes inside a literal (\"Standard\"/\"High\"), which will render the backslashes in generated documentation. Use unescaped quotes inside the reST literal instead.
        :param priority:
            The new priority of the job.
            One of :class:`~azure.quantum.Priority` (``\"Standard\"`` or ``\"High\"``).

azure-quantum/tests/test_workspace.py:12

  • The test imports Priority from the generated _client package, which doesn’t validate the PR’s claim that Priority is publicly exposed from azure.quantum. Importing from the public surface ensures the test covers the intended API contract.
from azure.quantum.job.job import Job
from azure.quantum._client.models import JobDetails
from azure.quantum._client.models import Priority
from azure.quantum._constants import EnvironmentVariables, ConnectionConstants
  • Files reviewed: 5/6 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Not ready to approve

The mock jobs.update() return value does not currently match the generated client’s contract (missing required id), and update_job() should consistently use a single captured job_id to avoid update/get mismatch risk.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Review details

Suppressed comments (2)

azure-quantum/azure/quantum/workspace.py:526

  • update_job() uses job.details.id for the update call but job.id for the subsequent get. If those ever diverge (e.g., details refreshed/swapped), this can update one job and fetch another. Capture a single job_id once and use it for both calls.
            self.subscription_id,
            self.resource_group,
            self.name,
            job.details.id,
            update_options)

azure-quantum/tests/mock_client.py:220

  • JobsOperations.update() returns the same resource object that was passed in, but the real generated client deserializes and returns a JobUpdateOptions response that includes the job id (required field). Returning an object without id can break callers/tests that rely on the mocked return value matching the service contract.
                return resource
  • Files reviewed: 5/6 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Ready to approve

The implementation matches the generated client’s update contract, includes input validation, and is covered by focused unit tests and mock support.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Review details
  • Files reviewed: 5/6 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

@v-elegacheva
v-elegacheva marked this pull request as ready for review August 4, 2026 21:30
@v-elegacheva
v-elegacheva requested a review from a team as a code owner August 4, 2026 21:30
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@v-elegacheva

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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.

2 participants