Skip to content

Commit f05fe5d

Browse files
committed
feat(python): support ITKWASM_CACHE_DIR for cache directory
Provide a way to specify the cache directory on AWS Lambda, where the user_cache_dir is not writable.
1 parent d26d8c8 commit f05fe5d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/core/python/itkwasm/itkwasm/pipeline.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import List, Union, Dict, Tuple, Set
55
import ctypes
66
import sys
7+
import os
78

89
import numpy as np
910
try:
@@ -32,7 +33,10 @@
3233

3334
from wasmtime import Config, Store, Engine, Module, WasiConfig, Linker, WasmtimeError
3435

35-
_module_store_dir = Path(user_cache_dir("itkwasm"))
36+
# Get the value of the ITKWASM_CACHE_DIR environment variable
37+
# If it is not set, use the default cache directory
38+
_module_store_dir = os.environ.get("ITKWASM_CACHE_DIR", user_cache_dir("itkwasm"))
39+
_module_store_dir = Path(_module_store_dir)
3640
_module_store_dir.mkdir(parents=True, exist_ok=True)
3741

3842
def array_like_to_bytes(arr: ArrayLike) -> bytes:

0 commit comments

Comments
 (0)