Skip to content

Commit 1819ae1

Browse files
committed
Put max workers config back in worker processes as setting globally did not appear to be fully honored
1 parent 00beeea commit 1819ae1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/mdio/segy/_workers.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ def _init_worker(segy_file_kwargs: SegyFileArguments) -> None:
4242

4343
from segy import SegyFile
4444

45-
# Setting the zarr config to 1 thread to ensure we honor the `MDIO__IMPORT__MAX_WORKERS` environment variable.
46-
# The Zarr 3 engine utilizes multiple threads. This can lead to resource contention and unpredictable memory usage.
47-
zarr_config.set({"threading.max_workers": 1})
48-
4945
# Open the SEG-Y file once per worker
5046
_worker_segy_file = SegyFile(**segy_file_kwargs)
5147

@@ -114,6 +110,9 @@ def trace_worker( # noqa: PLR0913
114110
SummaryStatistics object containing statistics about the written traces.
115111
"""
116112
global _worker_segy_file
113+
# Setting the zarr config to 1 thread to ensure we honor the `MDIO__IMPORT__CPU_COUNT` environment variable.
114+
# The Zarr 3 engine utilizes multiple threads. This can lead to resource contention and unpredictable memory usage.
115+
zarr_config.set({"threading.max_workers": 1})
117116

118117
# Use the pre-opened segy file from worker initialization
119118
segy_file = _worker_segy_file

0 commit comments

Comments
 (0)