Skip to content

Commit

Permalink
REFACTOR-modin-project#2059: Make computed default be on demand
Browse files Browse the repository at this point in the history
Signed-off-by: Vasilij Litvinov <[email protected]>
  • Loading branch information
vnlitvinov committed Oct 12, 2020
1 parent 0247ad3 commit efb007e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 2 additions & 4 deletions modin/config/envvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class Engine(EnvironmentVariable, type=str):
varname = "MODIN_ENGINE"
choices = ("Ray", "Dask", "Python")

def __compute_default():
@classmethod
def _get_default(cls):
if IsDebug.get():
return "Python"
try:
Expand Down Expand Up @@ -84,9 +85,6 @@ def __compute_default():
)
return "Dask"

default = __compute_default()
del __compute_default


class Backend(EnvironmentVariable, type=str):
"""
Expand Down
6 changes: 5 additions & 1 deletion modin/config/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,18 @@ def subscribe(cls, callback):
cls._subs.append(callback)
callback(cls)

@classmethod
def _get_default(cls):
return cls.default

@classmethod
def get(cls):
if cls._value is _UNSET:
# get the value from env
try:
raw = cls._get_raw_from_config()
except KeyError:
cls._value = cls.default
cls._value = cls._get_default()
else:
cls._value = _TYPE_PARAMS[cls.type].decode(raw)
return cls._value
Expand Down

0 comments on commit efb007e

Please sign in to comment.