From a1477c33a07e41a692c1b4cc09b050c1df3aa4fa Mon Sep 17 00:00:00 2001 From: Luke <111022789+ldantek@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:38:09 -0700 Subject: [PATCH] TSP environment cleanup (#328) * fix: perform garbage collection of TSP environment on cleanup. * Update CHANGELOG.md Co-authored-by: Nicholas Felt Signed-off-by: Luke <111022789+ldantek@users.noreply.github.com> --------- Signed-off-by: Luke <111022789+ldantek@users.noreply.github.com> Co-authored-by: Nicholas Felt --- CHANGELOG.md | 4 ++++ .../source_measure_units/smu24xx/smu24xx_standard.py | 4 ++++ src/tm_devices/drivers/pi/tsp_device.py | 11 +++++++---- tests/sim_devices/daq/daq6510.yaml | 1 + tests/sim_devices/dmm/dmm6500.yaml | 1 + tests/sim_devices/dmm/dmm7510.yaml | 1 + tests/sim_devices/dmm/dmm7512.yaml | 1 + tests/sim_devices/smu/smu2450.yaml | 1 + tests/sim_devices/smu/smu2460.yaml | 1 + tests/sim_devices/smu/smu2461.yaml | 1 + tests/sim_devices/smu/smu2470.yaml | 1 + tests/sim_devices/smu/smu2601a.yaml | 1 + tests/sim_devices/smu/smu2601b.yaml | 1 + tests/sim_devices/smu/smu2601b_pulse.yaml | 1 + tests/sim_devices/smu/smu2602a.yaml | 1 + tests/sim_devices/smu/smu2602b.yaml | 1 + tests/sim_devices/smu/smu2604a.yaml | 1 + tests/sim_devices/smu/smu2604b.yaml | 1 + tests/sim_devices/smu/smu2606b.yaml | 1 + tests/sim_devices/smu/smu2611a.yaml | 1 + tests/sim_devices/smu/smu2611b.yaml | 1 + tests/sim_devices/smu/smu2612a.yaml | 1 + tests/sim_devices/smu/smu2612b.yaml | 1 + tests/sim_devices/smu/smu2614a.yaml | 1 + tests/sim_devices/smu/smu2614b.yaml | 1 + tests/sim_devices/smu/smu2634a.yaml | 1 + tests/sim_devices/smu/smu2634b.yaml | 1 + tests/sim_devices/smu/smu2635a.yaml | 1 + tests/sim_devices/smu/smu2635b.yaml | 1 + tests/sim_devices/smu/smu2636a.yaml | 1 + tests/sim_devices/smu/smu2636b.yaml | 1 + tests/sim_devices/smu/smu2651a.yaml | 1 + tests/sim_devices/smu/smu2657a.yaml | 1 + tests/sim_devices/smu/smu6430.yaml | 1 + tests/sim_devices/smu/smu6514.yaml | 1 + tests/sim_devices/smu/smu6517b.yaml | 1 + tests/sim_devices/ss/ss3706a.yaml | 1 + 37 files changed, 49 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05874a0a..53589763 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ Valid subsections within a version are: Things to be included in the next release go here. +### Added + +- `collectgarbage()` is now called during cleanup of `TSPDevice` children. + --- ### Added diff --git a/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py b/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py index 9f2016b2..0a1e9b89 100644 --- a/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py +++ b/src/tm_devices/drivers/pi/source_measure_units/smu24xx/smu24xx_standard.py @@ -136,3 +136,7 @@ def load_script( ################################################################################################ # Private Methods ################################################################################################ + + def _cleanup(self) -> None: + """Perform the cleanup defined for the device.""" + PIDevice._cleanup(self) # noqa: SLF001 diff --git a/src/tm_devices/drivers/pi/tsp_device.py b/src/tm_devices/drivers/pi/tsp_device.py index 81af7f8f..8506265d 100644 --- a/src/tm_devices/drivers/pi/tsp_device.py +++ b/src/tm_devices/drivers/pi/tsp_device.py @@ -277,7 +277,10 @@ def write_buffers(self, filepath: str, *args: str, sep: str = ",") -> None: ) self.export_buffers(filepath, *args, sep=sep) - -################################################################################################ -# Private Methods -################################################################################################ + ################################################################################################ + # Private Methods + ################################################################################################ + def _cleanup(self) -> None: + """Perform the cleanup defined for the device.""" + super()._cleanup() + self.write("collectgarbage()") diff --git a/tests/sim_devices/daq/daq6510.yaml b/tests/sim_devices/daq/daq6510.yaml index 8ac9e542..10e28ec8 100644 --- a/tests/sim_devices/daq/daq6510.yaml +++ b/tests/sim_devices/daq/daq6510.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/dmm/dmm6500.yaml b/tests/sim_devices/dmm/dmm6500.yaml index e691e50e..e9852c7d 100644 --- a/tests/sim_devices/dmm/dmm6500.yaml +++ b/tests/sim_devices/dmm/dmm6500.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/dmm/dmm7510.yaml b/tests/sim_devices/dmm/dmm7510.yaml index 4f1ea04e..a3ab4ecd 100644 --- a/tests/sim_devices/dmm/dmm7510.yaml +++ b/tests/sim_devices/dmm/dmm7510.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/dmm/dmm7512.yaml b/tests/sim_devices/dmm/dmm7512.yaml index 8a494cc1..418d0f1b 100644 --- a/tests/sim_devices/dmm/dmm7512.yaml +++ b/tests/sim_devices/dmm/dmm7512.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2450.yaml b/tests/sim_devices/smu/smu2450.yaml index 10236a21..1c8a7503 100644 --- a/tests/sim_devices/smu/smu2450.yaml +++ b/tests/sim_devices/smu/smu2450.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2460.yaml b/tests/sim_devices/smu/smu2460.yaml index 5900db3e..e055d331 100644 --- a/tests/sim_devices/smu/smu2460.yaml +++ b/tests/sim_devices/smu/smu2460.yaml @@ -13,6 +13,7 @@ devices: - q: status.clear() - q: reset() - q: smu.source.sweeplinear("SolarCell", 0, 0.53, 56, 0.1) + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2461.yaml b/tests/sim_devices/smu/smu2461.yaml index 23df9025..45582f6c 100644 --- a/tests/sim_devices/smu/smu2461.yaml +++ b/tests/sim_devices/smu/smu2461.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2470.yaml b/tests/sim_devices/smu/smu2470.yaml index b5e2df0a..e5c0ef55 100644 --- a/tests/sim_devices/smu/smu2470.yaml +++ b/tests/sim_devices/smu/smu2470.yaml @@ -12,6 +12,7 @@ devices: - q: eventlog.clear() - q: status.clear() - q: reset() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2601a.yaml b/tests/sim_devices/smu/smu2601a.yaml index bbd3a0fc..918892e9 100644 --- a/tests/sim_devices/smu/smu2601a.yaml +++ b/tests/sim_devices/smu/smu2601a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2601b.yaml b/tests/sim_devices/smu/smu2601b.yaml index 11ea57a8..e08146ff 100644 --- a/tests/sim_devices/smu/smu2601b.yaml +++ b/tests/sim_devices/smu/smu2601b.yaml @@ -29,6 +29,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() - q: status.node_enable = 1 - q: print(status.node_enable) r: 1 diff --git a/tests/sim_devices/smu/smu2601b_pulse.yaml b/tests/sim_devices/smu/smu2601b_pulse.yaml index 24242f4e..8cfd52d2 100644 --- a/tests/sim_devices/smu/smu2601b_pulse.yaml +++ b/tests/sim_devices/smu/smu2601b_pulse.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2602a.yaml b/tests/sim_devices/smu/smu2602a.yaml index 4464171d..46bbdf5c 100644 --- a/tests/sim_devices/smu/smu2602a.yaml +++ b/tests/sim_devices/smu/smu2602a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2602b.yaml b/tests/sim_devices/smu/smu2602b.yaml index 726bf119..6a85a12d 100644 --- a/tests/sim_devices/smu/smu2602b.yaml +++ b/tests/sim_devices/smu/smu2602b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2604a.yaml b/tests/sim_devices/smu/smu2604a.yaml index 7cee65b8..7bda280a 100644 --- a/tests/sim_devices/smu/smu2604a.yaml +++ b/tests/sim_devices/smu/smu2604a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2604b.yaml b/tests/sim_devices/smu/smu2604b.yaml index 182a3e6d..df0a1a25 100644 --- a/tests/sim_devices/smu/smu2604b.yaml +++ b/tests/sim_devices/smu/smu2604b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2606b.yaml b/tests/sim_devices/smu/smu2606b.yaml index 6f825e06..b7958699 100644 --- a/tests/sim_devices/smu/smu2606b.yaml +++ b/tests/sim_devices/smu/smu2606b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2611a.yaml b/tests/sim_devices/smu/smu2611a.yaml index 1596797e..f30cb484 100644 --- a/tests/sim_devices/smu/smu2611a.yaml +++ b/tests/sim_devices/smu/smu2611a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2611b.yaml b/tests/sim_devices/smu/smu2611b.yaml index cd9810b9..f7e01632 100644 --- a/tests/sim_devices/smu/smu2611b.yaml +++ b/tests/sim_devices/smu/smu2611b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2612a.yaml b/tests/sim_devices/smu/smu2612a.yaml index 0e13e831..4a0c4fc1 100644 --- a/tests/sim_devices/smu/smu2612a.yaml +++ b/tests/sim_devices/smu/smu2612a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2612b.yaml b/tests/sim_devices/smu/smu2612b.yaml index 91008575..3355842c 100644 --- a/tests/sim_devices/smu/smu2612b.yaml +++ b/tests/sim_devices/smu/smu2612b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2614a.yaml b/tests/sim_devices/smu/smu2614a.yaml index 43c21b49..08500e87 100644 --- a/tests/sim_devices/smu/smu2614a.yaml +++ b/tests/sim_devices/smu/smu2614a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2614b.yaml b/tests/sim_devices/smu/smu2614b.yaml index 2fd9cebc..a6eda98f 100644 --- a/tests/sim_devices/smu/smu2614b.yaml +++ b/tests/sim_devices/smu/smu2614b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2634a.yaml b/tests/sim_devices/smu/smu2634a.yaml index 224c4b58..73113d76 100644 --- a/tests/sim_devices/smu/smu2634a.yaml +++ b/tests/sim_devices/smu/smu2634a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2634b.yaml b/tests/sim_devices/smu/smu2634b.yaml index b4a0bed0..b35e8f9c 100644 --- a/tests/sim_devices/smu/smu2634b.yaml +++ b/tests/sim_devices/smu/smu2634b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2635a.yaml b/tests/sim_devices/smu/smu2635a.yaml index 354a6323..81b687a1 100644 --- a/tests/sim_devices/smu/smu2635a.yaml +++ b/tests/sim_devices/smu/smu2635a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2635b.yaml b/tests/sim_devices/smu/smu2635b.yaml index 5547d027..271b6e3e 100644 --- a/tests/sim_devices/smu/smu2635b.yaml +++ b/tests/sim_devices/smu/smu2635b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2636a.yaml b/tests/sim_devices/smu/smu2636a.yaml index ee527805..4b7954d6 100644 --- a/tests/sim_devices/smu/smu2636a.yaml +++ b/tests/sim_devices/smu/smu2636a.yaml @@ -22,6 +22,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2636b.yaml b/tests/sim_devices/smu/smu2636b.yaml index d7cf971f..6fef3be0 100644 --- a/tests/sim_devices/smu/smu2636b.yaml +++ b/tests/sim_devices/smu/smu2636b.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2651a.yaml b/tests/sim_devices/smu/smu2651a.yaml index 8861be87..f99a2492 100644 --- a/tests/sim_devices/smu/smu2651a.yaml +++ b/tests/sim_devices/smu/smu2651a.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu2657a.yaml b/tests/sim_devices/smu/smu2657a.yaml index 1c8db918..32550b72 100644 --- a/tests/sim_devices/smu/smu2657a.yaml +++ b/tests/sim_devices/smu/smu2657a.yaml @@ -31,6 +31,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event) diff --git a/tests/sim_devices/smu/smu6430.yaml b/tests/sim_devices/smu/smu6430.yaml index 3fb3be73..b4a109cb 100644 --- a/tests/sim_devices/smu/smu6430.yaml +++ b/tests/sim_devices/smu/smu6430.yaml @@ -19,6 +19,7 @@ devices: r: '1' - q: '*RST' - q: '*CLS' + - q: collectgarbage() error: status_register: - q: '*ESR?' diff --git a/tests/sim_devices/smu/smu6514.yaml b/tests/sim_devices/smu/smu6514.yaml index a5f2d89a..7ab91a7e 100644 --- a/tests/sim_devices/smu/smu6514.yaml +++ b/tests/sim_devices/smu/smu6514.yaml @@ -19,6 +19,7 @@ devices: r: '1' - q: '*RST' - q: '*CLS' + - q: collectgarbage() error: status_register: - q: '*ESR?' diff --git a/tests/sim_devices/smu/smu6517b.yaml b/tests/sim_devices/smu/smu6517b.yaml index af63e9d6..b2084dba 100644 --- a/tests/sim_devices/smu/smu6517b.yaml +++ b/tests/sim_devices/smu/smu6517b.yaml @@ -19,6 +19,7 @@ devices: r: '1' - q: '*RST' - q: '*CLS' + - q: collectgarbage() error: status_register: - q: '*ESR?' diff --git a/tests/sim_devices/ss/ss3706a.yaml b/tests/sim_devices/ss/ss3706a.yaml index c13bdfa1..561f23a8 100644 --- a/tests/sim_devices/ss/ss3706a.yaml +++ b/tests/sim_devices/ss/ss3706a.yaml @@ -32,6 +32,7 @@ devices: - q: print([[0]]) r: 0 - q: waitcomplete() + - q: collectgarbage() error: status_register: - q: print(status.standard.event)