|
42 | 42 | ) |
43 | 43 | from feast.feature_service import FeatureService |
44 | 44 | from feast.feature_view import FeatureView |
| 45 | +from feast.infra.infra_object import Infra |
45 | 46 | from feast.on_demand_feature_view import OnDemandFeatureView |
46 | 47 | from feast.protos.feast.core.Registry_pb2 import Registry as RegistryProto |
47 | 48 | from feast.registry_store import NoopRegistryStore |
@@ -222,6 +223,36 @@ def _initialize_registry(self): |
222 | 223 | registry_proto.registry_schema_version = REGISTRY_SCHEMA_VERSION |
223 | 224 | self._registry_store.update_registry_proto(registry_proto) |
224 | 225 |
|
| 226 | + def update_infra(self, infra: Infra, project: str, commit: bool = True): |
| 227 | + """ |
| 228 | + Updates the stored Infra object. |
| 229 | +
|
| 230 | + Args: |
| 231 | + infra: The new Infra object to be stored. |
| 232 | + project: Feast project that the Infra object refers to |
| 233 | + commit: Whether the change should be persisted immediately |
| 234 | + """ |
| 235 | + self._prepare_registry_for_changes() |
| 236 | + assert self.cached_registry_proto |
| 237 | + |
| 238 | + self.cached_registry_proto.infra.CopyFrom(infra.to_proto()) |
| 239 | + if commit: |
| 240 | + self.commit() |
| 241 | + |
| 242 | + def get_infra(self, project: str, allow_cache: bool = False) -> Infra: |
| 243 | + """ |
| 244 | + Retrieves the stored Infra object. |
| 245 | +
|
| 246 | + Args: |
| 247 | + project: Feast project that the Infra object refers to |
| 248 | + allow_cache: Whether to allow returning this entity from a cached registry |
| 249 | +
|
| 250 | + Returns: |
| 251 | + The stored Infra object. |
| 252 | + """ |
| 253 | + registry_proto = self._get_registry_proto(allow_cache=allow_cache) |
| 254 | + return Infra.from_proto(registry_proto.infra) |
| 255 | + |
225 | 256 | def apply_entity(self, entity: Entity, project: str, commit: bool = True): |
226 | 257 | """ |
227 | 258 | Registers a single entity with Feast |
|
0 commit comments