Skip to content

Commit 0b262c0

Browse files
authored
ODSC-44021: Fix developer mode logic. Reduce testing time (#251)
2 parents 52d463f + d02919a commit 0b262c0

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

ads/feature_store/common/spark_session_singleton.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import os
1212

1313
from ads.common.oci_client import OCIClientFactory
14+
from ads.feature_store.common.utils.utility import get_env_bool
1415

1516
try:
1617
from delta import configure_spark_with_delta_pip
@@ -33,7 +34,7 @@
3334

3435

3536
def developer_enabled():
36-
return os.getenv("DEVELOPER_MODE")
37+
return get_env_bool("DEVELOPER_MODE", False)
3738

3839

3940
class SingletonMeta(type):

ads/feature_store/common/utils/utility.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8; -*-
33
import copy
4+
import os
45
# Copyright (c) 2023 Oracle and/or its affiliates.
56
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
67

@@ -62,6 +63,25 @@ def get_execution_engine_type(
6263
else ExecutionEngine.SPARK
6364
)
6465

66+
def get_env_bool(env_var: str, default: bool = False) -> bool:
67+
"""
68+
:param env_var: Environment variable name
69+
:param default: Default environment variable value
70+
:return: Value of the boolean env variable
71+
"""
72+
env_val = os.getenv(env_var)
73+
if env_val is None:
74+
env_val = default
75+
else:
76+
env_val = env_val.lower()
77+
if env_val == "true":
78+
env_val = True
79+
elif env_val == "false":
80+
env_val = False
81+
else:
82+
raise ValueError("For environment variable: {0} only string values T/true or F/false are allowed but: \
83+
{1} was provided.".format(env_var, env_val))
84+
return env_val
6585

6686
def get_metastore_id(feature_store_id: str):
6787
"""

0 commit comments

Comments
 (0)