diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1175b000f..f02576954 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,11 @@ Changelog ========= +Version 7.0 +=========== + +* Add calibration set ID to RunResult metadata. `#42 `_ + Version 6.2 =========== diff --git a/src/iqm_client/iqm_client.py b/src/iqm_client/iqm_client.py index 640deaa20..cee5b167f 100644 --- a/src/iqm_client/iqm_client.py +++ b/src/iqm_client/iqm_client.py @@ -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): diff --git a/tests/conftest.py b/tests/conftest.py index 774003a06..84c08f2d0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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') @@ -72,7 +73,7 @@ def settings_dict(): @pytest.fixture() def calibration_set_id(): - return 24 + return calibration_set_id_value @pytest.fixture @@ -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} } ) ) diff --git a/tests/test_iqm_client.py b/tests/test_iqm_client.py index 6e529b3c1..1f4eb271d 100644 --- a/tests/test_iqm_client.py +++ b/tests/test_iqm_client.py @@ -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 """ @@ -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):