From 62fae057d8c36af5f0f302c398f6134fc3c0407d Mon Sep 17 00:00:00 2001 From: mickey-liu Date: Thu, 20 Jan 2022 09:56:47 -0800 Subject: [PATCH] Split apply total parse repo (#2226) * random example commit Signed-off-by: Yun Nan Liu * random example commit Signed-off-by: Yun Nan Liu * first commit Signed-off-by: Yun Nan Liu * fix Signed-off-by: Yun Nan Liu * added method to apply with user-provided parsed_repo instance Signed-off-by: Yun Nan Liu * add apply_total_with_repo_instance to be called by apply_total Signed-off-by: Yun Nan Liu * fix styling and arg order Signed-off-by: Yun Nan Liu * fix lint issues Signed-off-by: Yun Nan Liu Co-authored-by: Yun Nan Liu --- sdk/python/feast/repo_operations.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/sdk/python/feast/repo_operations.py b/sdk/python/feast/repo_operations.py index 3e9ddb6e30..0638ca589a 100644 --- a/sdk/python/feast/repo_operations.py +++ b/sdk/python/feast/repo_operations.py @@ -237,12 +237,13 @@ def extract_objects_for_apply_delete(project, registry, repo): return all_to_apply, all_to_delete, views_to_delete, views_to_keep -@log_exceptions_and_usage -def apply_total(repo_config: RepoConfig, repo_path: Path, skip_source_validation: bool): - - os.chdir(repo_path) - project, registry, repo, store = _prepare_registry_and_repo(repo_config, repo_path) - +def apply_total_with_repo_instance( + store: FeatureStore, + project: str, + registry: Registry, + repo: RepoContents, + skip_source_validation: bool, +): if not skip_source_validation: data_sources = [t.batch_source for t in repo.feature_views] # Make sure the data source used by this feature view is supported by Feast @@ -262,6 +263,16 @@ def apply_total(repo_config: RepoConfig, repo_path: Path, skip_source_validation log_cli_output(diff, views_to_delete, views_to_keep) +@log_exceptions_and_usage +def apply_total(repo_config: RepoConfig, repo_path: Path, skip_source_validation: bool): + + os.chdir(repo_path) + project, registry, repo, store = _prepare_registry_and_repo(repo_config, repo_path) + apply_total_with_repo_instance( + store, project, registry, repo, skip_source_validation + ) + + def log_cli_output(diff, views_to_delete, views_to_keep): from colorama import Fore, Style