Skip to content

Commit 0e7f079

Browse files
fix: Engine initialization did not respect OS env (#2311)
1 parent c4d9b70 commit 0e7f079

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

awswrangler/_distributed.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@
1111
from importlib import reload
1212
from typing import Any, Callable, Dict, Literal, Optional, TypeVar, cast
1313

14-
WR_ENGINE = os.getenv("WR_ENGINE")
15-
WR_MEMORY_FORMAT = os.getenv("WR_MEMORY_FORMAT")
14+
EngineLiteral = Literal["python", "ray"]
15+
MemoryFormatLiteral = Literal["pandas", "modin"]
16+
17+
FunctionType = TypeVar("FunctionType", bound=Callable[..., Any])
18+
19+
20+
WR_ENGINE: Optional[EngineLiteral] = os.getenv("WR_ENGINE") # type: ignore[assignment]
21+
WR_MEMORY_FORMAT: Optional[MemoryFormatLiteral] = os.getenv("WR_MEMORY_FORMAT") # type: ignore[assignment]
1622

1723

1824
@unique
@@ -31,11 +37,6 @@ class MemoryFormatEnum(Enum):
3137
PANDAS = "pandas"
3238

3339

34-
EngineLiteral = Literal["python", "ray"]
35-
MemoryFormatLiteral = Literal["pandas", "modin"]
36-
FunctionType = TypeVar("FunctionType", bound=Callable[..., Any])
37-
38-
3940
class Engine:
4041
"""Execution engine configuration class."""
4142

@@ -111,7 +112,7 @@ def wrapper(*args: Any, **kw: Dict[str, Any]) -> Any:
111112
def register(cls, name: Optional[EngineLiteral] = None) -> None:
112113
"""Register the distribution engine dispatch methods."""
113114
with cls._lock:
114-
engine_name = cast(EngineLiteral, name or cls.get_installed().value)
115+
engine_name = cast(EngineLiteral, name or cls.get().value)
115116
cls.set(engine_name)
116117
cls._registry.clear()
117118

0 commit comments

Comments
 (0)