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

Fix BYOB job results bytes typing issue #1220

Merged
merged 8 commits into from
Nov 16, 2023
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
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/runtime_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _download_external_result(self, response: Any) -> Any:
if "url" in result_url_json:
url = result_url_json["url"]
result_response = requests.get(url, timeout=10)
return result_response.content
return result_response.text
return response
except json.JSONDecodeError:
return response
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/byte-result-bug-7afb5abe813f5b1b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Fixed an issue where canceled and failed jobs would return an invalid result that
resulted in a type error, preventing the actual error from being returned
to the user.
2 changes: 1 addition & 1 deletion test/unit/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def test_download_external_job_result(self, service):
job = run_program(service=service)
with mock_wait_for_final_state(service, job):
mock_response = MagicMock()
mock_response.content = "content-from-external-url"
mock_response.text = "content-from-external-url"
request_mock.get.return_value = mock_response
with mock_wait_for_final_state(service, job):
job.wait_for_final_state()
Expand Down
Loading