Skip to content

Commit

Permalink
Merge pull request #42 from iqm-finland/COMP-318-add-calibration-set-…
Browse files Browse the repository at this point in the history
…id-to-run-result-metadata

Add calibration set ID into RunResult metadata
  • Loading branch information
ollityrkko authored Sep 2, 2022
2 parents c5cab12 + 592ddd9 commit 2d7bfd4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
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

0 comments on commit 2d7bfd4

Please sign in to comment.