diff --git a/sdk/python/feast/cli.py b/sdk/python/feast/cli.py index 609720e0f0..960afc76f7 100644 --- a/sdk/python/feast/cli.py +++ b/sdk/python/feast/cli.py @@ -21,7 +21,7 @@ import pkg_resources import yaml -from feast import flags, utils +from feast import flags, flags_helper, utils from feast.errors import FeastObjectNotFoundException, FeastProviderLoginError from feast.feature_store import FeatureStore from feast.repo_config import load_repo_config @@ -432,14 +432,26 @@ def alpha_cmd(): @alpha_cmd.command("list") -def list_alpha_features(): +@click.pass_context +def list_alpha_features(ctx: click.Context): """ Lists all alpha features """ + repo = ctx.obj["CHDIR"] + cli_check_repo(repo) + repo_path = str(repo) + store = FeatureStore(repo_path=repo_path) + flags_to_show = flags.FLAG_NAMES.copy() flags_to_show.remove(flags.FLAG_ALPHA_FEATURES_NAME) print("Alpha features:") - print(*flags_to_show, sep="\n") + for flag in flags_to_show: + enabled_string = ( + "enabled" + if flags_helper.feature_flag_enabled(store.config, flag) + else "disabled" + ) + print(f"{flag}: {enabled_string}") @alpha_cmd.command("enable-all") diff --git a/sdk/python/feast/errors.py b/sdk/python/feast/errors.py index 9797ddf808..0d4fb929d9 100644 --- a/sdk/python/feast/errors.py +++ b/sdk/python/feast/errors.py @@ -263,5 +263,6 @@ def __init__(self, feature_view_name: str): class ExperimentalFeatureNotEnabled(Exception): def __init__(self, feature_flag_name: str): super().__init__( - f"You are attempting to use an experimental feature. Please run `feast alpha enable {feature_flag_name}`" + f"You are attempting to use an experimental feature that is not enabled. Please run " + f"`feast alpha enable {feature_flag_name}` " ) diff --git a/sdk/python/feast/flags.py b/sdk/python/feast/flags.py index bda615ca0e..67c50057cb 100644 --- a/sdk/python/feast/flags.py +++ b/sdk/python/feast/flags.py @@ -1,6 +1,6 @@ -FLAG_ALPHA_FEATURES_NAME = "enable_alpha_features" -FLAG_ON_DEMAND_TRANSFORM_NAME = "enable_on_demand_transforms" -FLAG_PYTHON_FEATURE_SERVER_NAME = "enable_python_feature_server" +FLAG_ALPHA_FEATURES_NAME = "alpha_features" +FLAG_ON_DEMAND_TRANSFORM_NAME = "on_demand_transforms" +FLAG_PYTHON_FEATURE_SERVER_NAME = "python_feature_server" ENV_FLAG_IS_TEST = "IS_TEST" FLAG_NAMES = { diff --git a/sdk/python/feast/flags_helper.py b/sdk/python/feast/flags_helper.py index 8d68cfca0f..a8f3373e1e 100644 --- a/sdk/python/feast/flags_helper.py +++ b/sdk/python/feast/flags_helper.py @@ -8,9 +8,12 @@ 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: +def feature_flag_enabled(repo_config: RepoConfig, flag_name: str) -> bool: + if is_test(): + return True return ( - repo_config.flags is not None + _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] ) @@ -29,16 +32,8 @@ def is_test() -> bool: def enable_on_demand_feature_views(repo_config: RepoConfig) -> bool: - if is_test(): - return True - return _alpha_feature_flag_enabled(repo_config) and _feature_flag_enabled( - repo_config, flags.FLAG_ON_DEMAND_TRANSFORM_NAME - ) + return feature_flag_enabled(repo_config, flags.FLAG_ON_DEMAND_TRANSFORM_NAME) def enable_python_feature_server(repo_config: RepoConfig) -> bool: - if is_test(): - return True - return _alpha_feature_flag_enabled(repo_config) and _feature_flag_enabled( - repo_config, flags.FLAG_PYTHON_FEATURE_SERVER_NAME - ) + return feature_flag_enabled(repo_config, flags.FLAG_PYTHON_FEATURE_SERVER_NAME)