Add support for job delete operation#758
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Adds first-class support for deleting Azure Quantum jobs through the Workspace API, and wires that operation into the Cirq integration so cirq.Job.delete() uses the delete operation instead of cancel.
Changes:
- Add
Workspace.delete_job()that calls the underlying jobs clientdeleteoperation. - Update
azure.quantum.cirq.Job.delete()to invokeworkspace.delete_job(...). - Add a unit test intended to validate the new delete behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| azure-quantum/azure/quantum/workspace.py | Introduces delete_job() API on Workspace calling the jobs delete operation. |
| azure-quantum/azure/quantum/cirq/job.py | Switches Cirq job deletion to use Workspace.delete_job() instead of cancellation. |
| azure-quantum/tests/test_workspace.py | Adds a new test case covering job delete behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def delete_job(self, job: Job) -> None: | ||
| """ | ||
| Deletes a job. | ||
|
|
||
| :param job: | ||
| Job to delete. | ||
| """ |
| container_uri="http://example.com/container", | ||
| input_data_format="microsoft.resource-estimates.v2", | ||
| provider_id="ionq", | ||
| target="ionq.simulator", | ||
| status="Executing" |
| ws.delete_job(job) | ||
|
|
||
| stored_job = ws.get_job(job_id) | ||
|
|
||
| assert stored_job.details.status == "Cancelled" |
|
@v-elegacheva please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
| def delete(self): | ||
| """Delete the given job.""" | ||
| self._azure_job.workspace.cancel_job(self._azure_job) | ||
| self._azure_job.workspace.delete_job(self._azure_job) |
There was a problem hiding this comment.
would you like to update also
azure-quantum\azure\quantum\cirq\targets\ionq.py?
maybe other places where delete operation would be appropriate?
|
|
||
| stored_job = ws.get_job(job_id) | ||
|
|
||
| assert stored_job.details.status == "Cancelled" |
There was a problem hiding this comment.
so when we delete the job the status should be "Cancelled"? what's the difference with cancel operation then?
add job delete operation support