From a8b5d3bb675b3a6e2fdbbde6edea45c17d5a7d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20M=C3=BCller?= Date: Wed, 14 Aug 2024 00:52:41 +0200 Subject: [PATCH] bmk: cleanup --- benchmark/bm_write_deque_writer_thread.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/benchmark/bm_write_deque_writer_thread.py b/benchmark/bm_write_deque_writer_thread.py index 508df23..142e2d9 100644 --- a/benchmark/bm_write_deque_writer_thread.py +++ b/benchmark/bm_write_deque_writer_thread.py @@ -1,5 +1,7 @@ +import atexit from collections import deque import pathlib +import shutil import tempfile import multiprocessing as mp @@ -30,8 +32,9 @@ def setup(): writer_dq.append(("mask", rng.random((batch_size, 80, 320)) > .5)) writer_dq.append(("temp", rng.normal(23, size=batch_size))) - path_out = pathlib.Path( - tempfile.mkdtemp(prefix=pathlib.Path(__file__).name)) / "out.rtdc" + temp_dir = tempfile.mkdtemp(prefix=pathlib.Path(__file__).name) + atexit.register(shutil.rmtree, temp_dir, ignore_errors=True, onerror=None) + path_out = pathlib.Path(temp_dir) / "out.rtdc" def main():