forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflags_helper.py
More file actions
47 lines (30 loc) · 1.41 KB
/
flags_helper.py
File metadata and controls
47 lines (30 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os
from feast import flags
from feast.repo_config import RepoConfig
def _env_flag_enabled(name: str) -> bool:
return os.getenv(name, default="False") == "True"
def feature_flag_enabled(repo_config: RepoConfig, flag_name: str) -> bool:
if is_test():
return True
return (
_alpha_feature_flag_enabled(repo_config)
and repo_config.flags is not None
and flag_name in repo_config.flags
and repo_config.flags[flag_name]
)
def _alpha_feature_flag_enabled(repo_config: RepoConfig) -> bool:
return (
repo_config.flags is not None
and flags.FLAG_ALPHA_FEATURES_NAME in repo_config.flags
and repo_config.flags[flags.FLAG_ALPHA_FEATURES_NAME]
)
def is_test() -> bool:
return _env_flag_enabled(flags.ENV_FLAG_IS_TEST)
def enable_on_demand_feature_views(repo_config: RepoConfig) -> bool:
return feature_flag_enabled(repo_config, flags.FLAG_ON_DEMAND_TRANSFORM_NAME)
def enable_python_feature_server(repo_config: RepoConfig) -> bool:
return feature_flag_enabled(repo_config, flags.FLAG_PYTHON_FEATURE_SERVER_NAME)
def enable_aws_lambda_feature_server(repo_config: RepoConfig) -> bool:
return feature_flag_enabled(repo_config, flags.FLAG_AWS_LAMBDA_FEATURE_SERVER_NAME)
def enable_direct_ingestion_to_online_store(repo_config: RepoConfig) -> bool:
return feature_flag_enabled(repo_config, flags.FLAG_DIRECT_INGEST_TO_ONLINE_STORE)