github-actions[bot] commented on code in PR #41427:
URL: https://github.com/apache/beam/pull/41427#discussion_r4600959481


##########
sdks/python/apache_beam/transforms/enrichment_handlers/feast_feature_store.py:
##########
@@ -144,10 +145,11 @@ def __init__(
 
   def __enter__(self):
     """Connect with the Feast feature store."""
-    local_repo_path = download_fs_yaml_file(self.feature_store_yaml_path)
+    self._local_repo_path = download_fs_yaml_file(self.feature_store_yaml_path)
     try:
-      self.store = FeatureStore(fs_yaml_file=local_repo_path)
+      self.store = FeatureStore(fs_yaml_file=self._local_repo_path)
     except Exception:
+      self._remove_local_repo_path()

Review Comment:
   **🟢 Low**: If `self.store.get_feature_service(self.feature_service_name)` 
fails in the `try...except` block immediately following this one in `__enter__` 
(lines 158–165), `__exit__` will not be invoked by context managers (and 
`_CallDoFn.teardown` will fail before calling `__exit__` because 
`_metrics_collector` is not yet initialized). Consider calling 
`self._remove_local_repo_path()` in that `except Exception:` block as well so 
the downloaded temp YAML file is also cleaned up when feature service lookup 
fails.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to