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

Add calibration set ID into RunResult metadata #42

Merged
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
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

Version 7.0
===========

* Add calibration set ID to RunResult metadata. `#42 <https://github.com/iqm-finland/iqm-client/pull/42>`_

Version 6.2
===========

Expand Down
4 changes: 4 additions & 0 deletions src/iqm_client/iqm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ class Metadata(BaseModel):
'mapping of logical qubit names to physical qubit names, or None if using physical qubit names'
circuits: list[Circuit] = Field(..., description='batch of quantum circuit(s) to execute')
'batch of quantum circuit(s) to execute'
calibration_set_id: Optional[int] = Field(
None,
description='ID of the calibration set used, or None if settings were specified'
)


class RunResult(BaseModel):
Expand Down
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

REQUESTS_TIMEOUT = 10

calibration_set_id_value = 24
existing_run = UUID('3c3fcda3-e860-46bf-92a4-bcc59fa76ce9')
missing_run = UUID('059e4186-50a3-4e6c-ba1f-37fe6afbdfc2')

Expand Down Expand Up @@ -72,7 +73,7 @@ def settings_dict():

@pytest.fixture()
def calibration_set_id():
return 24
return calibration_set_id_value


@pytest.fixture
Expand Down Expand Up @@ -157,7 +158,7 @@ def generate_server_stubs(base_url, sample_circuit):
{
'status': 'ready',
'measurements': [{'result': [[1, 0, 1, 1], [1, 0, 0, 1], [1, 0, 1, 1], [1, 0, 1, 1]]}],
'metadata': {'shots': 42, 'circuits': [sample_circuit]}
'metadata': {'shots': 42, 'circuits': [sample_circuit], 'calibration_set_id': calibration_set_id_value}
}
)
)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_iqm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_submit_circuits_without_qubit_mapping_returns_id(mock_server, settings_
assert job_id == existing_run


def test_get_run_status_and_results_for_existing_run(mock_server, base_url, settings_dict):
def test_get_run_status_and_results_for_existing_run(mock_server, base_url, settings_dict, calibration_set_id):
"""
Tests getting the run status
"""
Expand All @@ -131,6 +131,7 @@ def test_get_run_status_and_results_for_existing_run(mock_server, base_url, sett
ready_run = client.get_run(existing_run)
assert ready_run.status == Status.READY
assert ready_run.measurements is not None
assert ready_run.metadata.calibration_set_id == calibration_set_id


def test_get_run_status_for_existing_run(mock_server, base_url, settings_dict):
Expand Down