diff --git a/HISTORY.md b/HISTORY.md index e80269f..0f7f6ce 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,9 @@ # History +## 0.15.2 (2025-01-23) + +* Removes running in a ProcessPoolExecutor + ## 0.15.1 (2025-01-23) * Fix potential memory leaks by confining use of `pyvips` to subprocesses diff --git a/panimg/image_builders/tiff.py b/panimg/image_builders/tiff.py index 81c22dd..3a8afeb 100644 --- a/panimg/image_builders/tiff.py +++ b/panimg/image_builders/tiff.py @@ -2,7 +2,6 @@ import re from collections import defaultdict from collections.abc import Callable, Iterator -from concurrent.futures import ProcessPoolExecutor from dataclasses import dataclass, field from pathlib import Path from tempfile import TemporaryDirectory @@ -325,13 +324,11 @@ def _convert( if associated_files_getter: associated_files = associated_files_getter(gc_file.path) - with ProcessPoolExecutor(max_workers=1) as executor: - tiff_file = executor.submit( - _convert_to_tiff, - path=file, - pk=gc_file.pk, - output_directory=output_directory, - ).result() + tiff_file = _convert_to_tiff( + path=file, + pk=gc_file.pk, + output_directory=output_directory, + ) except Exception as e: file_errors[file].append( format_error( diff --git a/panimg/post_processors/tiff_to_dzi.py b/panimg/post_processors/tiff_to_dzi.py index fe5fdd9..3a4fde0 100644 --- a/panimg/post_processors/tiff_to_dzi.py +++ b/panimg/post_processors/tiff_to_dzi.py @@ -1,5 +1,4 @@ import logging -from concurrent.futures import ProcessPoolExecutor from panimg.models import ImageType, PanImgFile, PostProcessorResult from panimg.settings import DZI_TILE_SIZE @@ -13,10 +12,7 @@ def tiff_to_dzi(*, image_files: set[PanImgFile]) -> PostProcessorResult: for file in image_files: if file.image_type == ImageType.TIFF: try: - with ProcessPoolExecutor(max_workers=1) as executor: - result = executor.submit( - _create_dzi_image, tiff_file=file - ).result() + result = _create_dzi_image(tiff_file=file) except Exception as e: logger.warning(f"Could not create DZI for {file}: {e}") continue diff --git a/pyproject.toml b/pyproject.toml index 9f85850..b7c7080 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "panimg" -version = "0.15.1" +version = "0.15.2" description = "Conversion of medical images to MHA and TIFF." license = "Apache-2.0" authors = ["James Meakin "]