From ed3c3a2afcf698ea14cc13e68de3389ee70834f8 Mon Sep 17 00:00:00 2001 From: "oliver.gordon" Date: Mon, 9 Sep 2024 17:08:12 +0200 Subject: [PATCH] emu fresnel access in SDK --- pasqal_cloud/batch.py | 8 +++++++- pasqal_cloud/device/configuration/__init__.py | 2 ++ pasqal_cloud/device/configuration/emu_fresnel.py | 8 ++++++++ pasqal_cloud/device/emulator_types.py | 1 + tests/test_batch.py | 1 + 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 pasqal_cloud/device/configuration/emu_fresnel.py diff --git a/pasqal_cloud/batch.py b/pasqal_cloud/batch.py index b05111a2..1e4b164c 100644 --- a/pasqal_cloud/batch.py +++ b/pasqal_cloud/batch.py @@ -7,7 +7,11 @@ from pasqal_cloud.client import Client from pasqal_cloud.device import EmulatorType -from pasqal_cloud.device.configuration import BaseConfig, EmuFreeConfig, EmuTNConfig +from pasqal_cloud.device.configuration import ( + BaseConfig, + EmuFreeConfig, + EmuTNConfig, +) from pasqal_cloud.errors import ( BatchCancellingError, BatchClosingError, @@ -133,6 +137,8 @@ def _load_configuration( conf_class = EmuTNConfig elif info.data["device_type"] == EmulatorType.EMU_FREE.value: conf_class = EmuFreeConfig + elif info.data["device_type"] == EmulatorType.EMU_FRESNEL.value: + return None return conf_class.from_dict(configuration) def add_jobs( diff --git a/pasqal_cloud/device/configuration/__init__.py b/pasqal_cloud/device/configuration/__init__.py index 4d6c2415..8e0dffe3 100644 --- a/pasqal_cloud/device/configuration/__init__.py +++ b/pasqal_cloud/device/configuration/__init__.py @@ -3,11 +3,13 @@ InvalidConfiguration, ) from pasqal_cloud.device.configuration.emu_free import EmuFreeConfig +from pasqal_cloud.device.configuration.emu_fresnel import EmuFresnelConfig from pasqal_cloud.device.configuration.emu_tn import EmuTNConfig __all__ = [ "BaseConfig", "EmuFreeConfig", + "EmuFresnelConfig", "EmuTNConfig", "InvalidConfiguration", ] diff --git a/pasqal_cloud/device/configuration/emu_fresnel.py b/pasqal_cloud/device/configuration/emu_fresnel.py new file mode 100644 index 00000000..9ee89d29 --- /dev/null +++ b/pasqal_cloud/device/configuration/emu_fresnel.py @@ -0,0 +1,8 @@ +from __future__ import annotations + +from dataclasses import dataclass + + +@dataclass +class EmuFresnelConfig: + """Configuration for the EMU_FRESNEL device type.""" diff --git a/pasqal_cloud/device/emulator_types.py b/pasqal_cloud/device/emulator_types.py index 13971f48..c67c10f0 100644 --- a/pasqal_cloud/device/emulator_types.py +++ b/pasqal_cloud/device/emulator_types.py @@ -4,3 +4,4 @@ class EmulatorType(StrEnum): EMU_FREE = "EMU_FREE" EMU_TN = "EMU_TN" + EMU_FRESNEL = "EMU_FRESNEL" diff --git a/tests/test_batch.py b/tests/test_batch.py index 348f2b00..93b33f82 100644 --- a/tests/test_batch.py +++ b/tests/test_batch.py @@ -384,6 +384,7 @@ def test_cancel_batch_sdk_error( EmuFreeConfig(), EmuFreeConfig(extra_config={"dt": 10.0, "precision": "normal"}), ), + (EmulatorType.EMU_FRESNEL, None, None), ( "SomethingElse", BaseConfig(),