diff --git a/src/braket/tasks/local_quantum_task.py b/src/braket/tasks/local_quantum_task.py index 69a0f1bd6..e8f4d4756 100644 --- a/src/braket/tasks/local_quantum_task.py +++ b/src/braket/tasks/local_quantum_task.py @@ -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__( @@ -42,8 +42,12 @@ def id(self) -> str: return str(self._id) def cancel(self) -> None: - """Cancel the quantum task.""" - raise NotImplementedError("Cannot cancel completed local task") + """Attempt to cancel the quantum task. + + Since this class is instantiated with the results, there is nothing to cancel. Attempting + to cancel an already completed task is not an error. + """ + pass def state(self) -> str: return "COMPLETED" diff --git a/test/unit_tests/braket/tasks/test_local_quantum_task.py b/test/unit_tests/braket/tasks/test_local_quantum_task.py index 6b583c608..1a6802e70 100644 --- a/test/unit_tests/braket/tasks/test_local_quantum_task.py +++ b/test/unit_tests/braket/tasks/test_local_quantum_task.py @@ -46,7 +46,6 @@ def test_result(): assert TASK.result() == RESULT -@pytest.mark.xfail(raises=NotImplementedError) def test_cancel(): TASK.cancel()