Skip to content

Commit

Permalink
change: Remove throw from local task cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
shpface committed Jan 20, 2024
1 parent 4b5f690 commit 1284adc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/braket/tasks/local_quantum_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class LocalQuantumTask(QuantumTask):
"""A quantum task containing the results of a local simulation.
Since this class is instantiated with the results, cancel() and run_async() are unsupported.
Since this class is instantiated with the results, run_async() is unsupported.
"""

def __init__(
Expand All @@ -43,7 +43,8 @@ def id(self) -> str:

def cancel(self) -> None:
"""Cancel the quantum task."""
raise NotImplementedError("Cannot cancel completed local task")
# A LocalQuantumTask is already completed, so there is nothing to cancel
pass

def state(self) -> str:
return "COMPLETED"
Expand Down
1 change: 0 additions & 1 deletion test/unit_tests/braket/tasks/test_local_quantum_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def test_result():
assert TASK.result() == RESULT


@pytest.mark.xfail(raises=NotImplementedError)
def test_cancel():
TASK.cancel()

Expand Down

0 comments on commit 1284adc

Please sign in to comment.