Skip to content

Commit 32c38aa

Browse files
authored
chore: Backward compatibility for test repo configurations (#2671)
* backward compatibility for all test repo configurations Signed-off-by: Oleksii Moskalenko <moskalenko.alexey@gmail.com> * format Signed-off-by: Oleksii Moskalenko <moskalenko.alexey@gmail.com> * fix arguments order Signed-off-by: Oleksii Moskalenko <moskalenko.alexey@gmail.com>
1 parent 0cbc5f2 commit 32c38aa

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

sdk/python/tests/integration/feature_repos/repo_configuration.py

+28-4
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,37 @@
101101
if full_repo_configs_module is not None:
102102
try:
103103
module = importlib.import_module(full_repo_configs_module)
104-
AVAILABLE_ONLINE_STORES = getattr(module, "AVAILABLE_ONLINE_STORES")
105-
AVAILABLE_OFFLINE_STORES = getattr(module, "AVAILABLE_OFFLINE_STORES")
106-
except Exception as e:
104+
except ImportError as e:
107105
raise FeastModuleImportError(
108-
"FULL_REPO_CONFIGS", full_repo_configs_module
106+
full_repo_configs_module, "FULL_REPO_CONFIGS"
109107
) from e
110108

109+
try:
110+
AVAILABLE_ONLINE_STORES = getattr(module, "AVAILABLE_ONLINE_STORES")
111+
AVAILABLE_OFFLINE_STORES = getattr(module, "AVAILABLE_OFFLINE_STORES")
112+
except AttributeError:
113+
try:
114+
FULL_REPO_CONFIGS: List[IntegrationTestRepoConfig] = getattr(
115+
module, "FULL_REPO_CONFIGS"
116+
)
117+
except AttributeError as e:
118+
raise FeastModuleImportError(
119+
full_repo_configs_module, "FULL_REPO_CONFIGS"
120+
) from e
121+
122+
AVAILABLE_OFFLINE_STORES = [
123+
(config.provider, config.offline_store_creator)
124+
for config in FULL_REPO_CONFIGS
125+
]
126+
AVAILABLE_OFFLINE_STORES = list(set(AVAILABLE_OFFLINE_STORES)) # unique only
127+
128+
AVAILABLE_ONLINE_STORES = {
129+
c.online_store["type"]
130+
if isinstance(c.online_store, dict)
131+
else c.online_store: (c.online_store, c.online_store_creator)
132+
for c in FULL_REPO_CONFIGS
133+
}
134+
111135

112136
if os.getenv("FEAST_LOCAL_ONLINE_CONTAINER", "False").lower() == "true":
113137
replacements: Dict[

0 commit comments

Comments
 (0)