From e11e0d04e60ef22f26221a28bf3457b5bdbda466 Mon Sep 17 00:00:00 2001 From: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:16:00 +0400 Subject: [PATCH 1/2] fix: remove QM manager when disconnecting --- src/qibolab/instruments/qm/controller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qibolab/instruments/qm/controller.py b/src/qibolab/instruments/qm/controller.py index e9017bb4b..abbb6f5d3 100644 --- a/src/qibolab/instruments/qm/controller.py +++ b/src/qibolab/instruments/qm/controller.py @@ -258,6 +258,7 @@ def disconnect(self): self._reset_temporary_calibration() if self.manager is not None: self.manager.close_all_quantum_machines() + self.manager = None self.is_connected = False def calibrate_mixers(self, qubits): From e46b12c0a57c593a7932d8a3ae8fe7101f6280ca Mon Sep 17 00:00:00 2001 From: Stavros Efthymiou <35475381+stavros11@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:22:00 +0400 Subject: [PATCH 2/2] feat: raise error when not connected --- src/qibolab/instruments/qm/controller.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qibolab/instruments/qm/controller.py b/src/qibolab/instruments/qm/controller.py index abbb6f5d3..c7d7871de 100644 --- a/src/qibolab/instruments/qm/controller.py +++ b/src/qibolab/instruments/qm/controller.py @@ -288,6 +288,10 @@ def execute_program(self, program): Args: program: QUA program. """ + if self.manager is None: + raise RuntimeError( + "Quantum Machines are not connected. Please use ``platform.connect()``." + ) machine = self.manager.open_qm(self.config.__dict__) return machine.execute(program)