Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 593 | Client: deprecate stop in favor of cancel #1494

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions client/qiskit_serverless/core/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,16 @@ def status(self):

def stop(self, service: Optional[QiskitRuntimeService] = None):
"""Stops the job from running."""
warnings.warn(
"`stop` method has been deprecated. "
"And will be removed in future releases. "
"Please, use `cancel` instead.",
DeprecationWarning,
)
return self.cancel(service)

def cancel(self, service: Optional[QiskitRuntimeService] = None):
"""Cancels the job."""
return self._job_client.stop(self.job_id, service=service)

def logs(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion client/tests/core/test_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ def test_program():
assert "42" in recovered_job.logs()
assert recovered_job.in_terminal_state()
assert recovered_job.status() == "DONE"
assert isinstance(job.stop(), bool)
assert isinstance(job.cancel(), bool)