Skip to content

Commit

Permalink
FIX-#2473: Some configuration values should not be transformed
Browse files Browse the repository at this point in the history
Signed-off-by: Vasilij Litvinov <[email protected]>
  • Loading branch information
vnlitvinov committed Nov 25, 2020
1 parent f7f1f7a commit 586efe8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modin/config/envvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import warnings
from packaging import version

from .pubsub import Parameter, _TYPE_PARAMS
from .pubsub import Parameter, _TYPE_PARAMS, ExactStr


class EnvironmentVariable(Parameter, type=str, abstract=True):
Expand Down Expand Up @@ -112,7 +112,7 @@ class IsRayCluster(EnvironmentVariable, type=bool):
varname = "MODIN_RAY_CLUSTER"


class RayRedisAddress(EnvironmentVariable, type=str):
class RayRedisAddress(EnvironmentVariable, type=ExactStr):
"""
What Redis address to connect to when running in Ray cluster
"""
Expand Down Expand Up @@ -142,7 +142,7 @@ class Memory(EnvironmentVariable, type=int):
varname = "MODIN_MEMORY"


class RayPlasmaDir(EnvironmentVariable, type=str):
class RayPlasmaDir(EnvironmentVariable, type=ExactStr):
"""
Path to Plasma storage for Ray
"""
Expand All @@ -158,7 +158,7 @@ class IsOutOfCore(EnvironmentVariable, type=bool):
varname = "MODIN_OUT_OF_CORE"


class SocksProxy(EnvironmentVariable, type=str):
class SocksProxy(EnvironmentVariable, type=ExactStr):
"""
SOCKS proxy address if it is needed for SSH to work
"""
Expand Down
12 changes: 12 additions & 0 deletions modin/config/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,23 @@ class TypeDescriptor(typing.NamedTuple):
help: str


class ExactStr(str):
"""
To be used in type params where no transformations are needed
"""


_TYPE_PARAMS = {
str: TypeDescriptor(
decode=lambda value: value.strip().title(),
normalize=lambda value: value.strip().title(),
verify=lambda value: True,
help="a case-insensitive string",
),
ExactStr: TypeDescriptor(
decode=lambda value: value,
normalize=lambda value: value,
verify=lambda value: True,
help="a string",
),
bool: TypeDescriptor(
Expand Down

0 comments on commit 586efe8

Please sign in to comment.