Skip to content

Commit 774564c

Browse files
authored
Merge branch 'master' into fix/operator-rbac-watch-clusterroles-7061
2 parents 5b381d6 + d3e2041 commit 774564c

14 files changed

Lines changed: 358 additions & 36 deletions

File tree

‎docs/getting-started/components/open-telemetry.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The OpenTelemetry integration in Feast consists of several components working to
3838
To add monitoring to the Feast Feature Server, follow these steps:
3939

4040
### 1. Deploy Prometheus Operator
41-
Follow the [Prometheus Operator documentation](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md) to install the operator.
41+
Follow the [Prometheus Operator documentation](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/getting-started/installation.md) to install the operator.
4242

4343
### 2. Deploy OpenTelemetry Operator
4444
Before installing the OpenTelemetry Operator:

‎docs/getting-started/concepts/feature-retrieval.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Each of these retrieval mechanisms accept:
1515
* some way of specifying entities (to fetch features for)
1616
* some way to specify the features to fetch (either via [feature services](feature-retrieval.md#feature-services), which group features needed for a model version, or [feature references](feature-retrieval.md#feature-references))
1717

18-
Before beginning, you need to instantiate a local `FeatureStore` object that knows how to parse the registry (see [more details](https://docs.feast.dev/getting-started/concepts/registry))
18+
Before beginning, you need to instantiate a local `FeatureStore` object that knows how to parse the registry (see [more details](https://docs.feast.dev/getting-started/components/registry))
1919

2020
For code examples of how the below work, inspect the generated repository from `feast init -t [YOUR TEMPLATE]` (`gcp`, `snowflake`, and `aws` are the most fully fleshed).
2121

‎docs/reference/online-stores/milvus.md‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,26 @@ When Feast finds an existing collection it checks its load state and loads it on
197197
Reads and searches never load collections, so a collection released outside Feast is only reloaded
198198
the next time a Feast process first accesses it.
199199

200+
## Row deletion
201+
202+
`MilvusOnlineStore.online_delete` removes rows of a feature view, by entity key or by filter:
203+
204+
```python
205+
from feast.filter_models import ComparisonFilter
206+
207+
online_store.online_delete(config, feature_view, entity_keys=[entity_key])
208+
online_store.online_delete(
209+
config,
210+
feature_view,
211+
filters=ComparisonFilter(type="eq", key="brand_id", value="acme"),
212+
)
213+
```
214+
215+
Give exactly one of `entity_keys` and `filters`. An empty key list deletes nothing, and a filter
216+
with an empty group is rejected, so a mistake cannot delete more rows than it names. A deleted row
217+
leaves no tombstone: a later write creates it again, and Feast does not order a delete against
218+
writes from other processes. Deletion works on every collection that Feast created.
219+
200220
## Feature views without vectors
201221

202222
Milvus requires every collection to have a vector field. For feature views that have no vector

‎go/infra/docker/feature-server/Dockerfile‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.26
1+
FROM golang:1.26-trixie AS builder
22
ENV GOTOOLCHAIN=auto
33

44
# Update the package list and install the ca-certificates package
@@ -24,6 +24,21 @@ RUN find ./protos -name "*.proto" \
2424
# Build the Go application
2525
RUN go build -o feast ./go/main.go
2626

27+
# Ship only the server binary on a slim base, so the Go toolchain, compilers and
28+
# kernel headers of the build image are not part of the published image. The
29+
# runtime uses the same Debian release as the builder, so the cgo-linked binary
30+
# finds a matching glibc.
31+
FROM debian:trixie-slim
32+
33+
# Update the package list and install the ca-certificates package
34+
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
35+
&& rm -rf /var/lib/apt/lists/*
36+
37+
# Set the current working directory inside the container
38+
WORKDIR /app
39+
40+
COPY --from=builder /app/feast ./feast
41+
2742
# Expose ports
2843
EXPOSE 8080
2944

‎infra/charts/feast-feature-server/opentelemetry.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Feast instrumentation Using OpenTelemetry and Prometheus -
88

99
### Deploy Prometheus Operator
1010
Follow the Prometheus Operator documentation to install the operator -
11-
https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md
11+
https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/getting-started/installation.md
1212

1313
### Deploy OpenTelemetry Operator
1414
Before installing OTEL Operator, install `cert-manager` and validate the `pods` should spin up --

‎sdk/python/feast/infra/online_stores/milvus_online_store/milvus.py‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ def translate_compound(self, f: CompoundFilter) -> str:
202202
return operator.join(clauses)
203203

204204

205+
def _has_empty_group(filters: FilterType) -> bool:
206+
"""True when a compound filter has no conditions, at any level."""
207+
return isinstance(filters, CompoundFilter) and (
208+
not filters.filters or any(_has_empty_group(f) for f in filters.filters)
209+
)
210+
211+
205212
class MilvusOnlineStoreConfig(FeastConfigBaseModel, VectorStoreConfig):
206213
"""
207214
Configuration for the Milvus online store.
@@ -706,6 +713,52 @@ def online_read(
706713

707714
return result_list
708715

716+
def online_delete(
717+
self,
718+
config: RepoConfig,
719+
table: FeatureView,
720+
entity_keys: Optional[List[EntityKeyProto]] = None,
721+
*,
722+
filters: Optional[Union[ComparisonFilter, CompoundFilter]] = None,
723+
) -> None:
724+
"""Delete rows of a feature view by entity key or by filter.
725+
726+
Give exactly one of ``entity_keys`` and ``filters``. An empty key list
727+
deletes nothing. A filter with an empty group is rejected, so a mistake
728+
cannot delete more rows than it names. No tombstone is kept: a later
729+
write creates the row again.
730+
"""
731+
if (entity_keys is None) == (filters is None):
732+
raise ValueError("Give exactly one of entity_keys or filters")
733+
selector: Dict[str, Any]
734+
if entity_keys is not None:
735+
if not entity_keys:
736+
return
737+
selector = {
738+
"ids": [
739+
serialize_entity_key(
740+
entity_key,
741+
entity_key_serialization_version=config.entity_key_serialization_version,
742+
).hex()
743+
for entity_key in entity_keys
744+
]
745+
}
746+
else:
747+
if _has_empty_group(filters):
748+
raise ValueError(
749+
"Each group of the deletion filter must have a condition"
750+
)
751+
selector = {"filter": MilvusFilterTranslator().translate(filters)}
752+
self.client = self._connect(config)
753+
collection_name = _table_id(
754+
config.project, table, config.registry.enable_online_feature_view_versioning
755+
)
756+
if collection_name not in self._collections:
757+
if not self.client.has_collection(collection_name):
758+
return
759+
self._ensure_loaded(collection_name)
760+
self.client.delete(collection_name=collection_name, **selector)
761+
709762
def update(
710763
self,
711764
config: RepoConfig,

‎sdk/python/feast/infra/registry/proto_registry_utils.py‎

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,34 @@
2828
from feast.saved_dataset import SavedDataset, ValidationReference
2929
from feast.stream_feature_view import StreamFeatureView
3030

31+
# The caches hold the registry proto itself and compare by identity. An id() key
32+
# is unsafe: once a proto is freed, a new proto can reuse its id, and registries
33+
# that leave version_id empty (SqlRegistry) then read another registry's objects.
34+
3135

3236
def registry_proto_cache(func):
37+
cache_proto = None
3338
cache_key = None
3439
cache_value = None
3540

3641
@wraps(func)
3742
def wrapper(registry_proto: RegistryProto, project: str):
38-
nonlocal cache_key, cache_value
43+
nonlocal cache_proto, cache_key, cache_value
3944

40-
key = tuple([id(registry_proto), registry_proto.version_id, project])
45+
key = (registry_proto.version_id, project)
4146

42-
if key == cache_key:
47+
if registry_proto is cache_proto and key == cache_key:
4348
return cache_value
4449
else:
4550
cache_value = func(registry_proto, project)
46-
cache_key = key
51+
cache_proto, cache_key = registry_proto, key
4752
return cache_value
4853

4954
return wrapper
5055

5156

5257
def registry_proto_cache_with_tags(func):
58+
cache_proto = None
5359
cache_key = None
5460
cache_value = None
5561

@@ -60,42 +66,43 @@ def wrapper(
6066
tags: Optional[dict[str, str]],
6167
**kwargs,
6268
):
63-
nonlocal cache_key, cache_value
69+
nonlocal cache_proto, cache_key, cache_value
6470

6571
kwargs_key = tuple(sorted(kwargs.items())) if kwargs else ()
6672
# Snapshot the filter so caller mutations cannot change a cached key.
6773
tags_key = frozenset(tags.items()) if tags is not None else None
6874
key = (
69-
id(registry_proto),
7075
registry_proto.version_id,
7176
project,
7277
tags_key,
7378
kwargs_key,
7479
)
7580

76-
if key == cache_key:
81+
if registry_proto is cache_proto and key == cache_key:
7782
return cache_value
7883
else:
7984
cache_value = func(registry_proto, project, tags, **kwargs)
80-
cache_key = key
85+
cache_proto, cache_key = registry_proto, key
8186
return cache_value
8287

8388
return wrapper
8489

8590

8691
def registry_proto_cache_name(func):
87-
cache_proto_key = None
92+
cache_proto = None
93+
cache_version = None
8894
cache = {}
8995

9096
@wraps(func)
9197
def wrapper(registry_proto: RegistryProto, name: str, project: str):
92-
nonlocal cache_proto_key, cache
93-
94-
proto_key = (id(registry_proto), registry_proto.version_id)
98+
nonlocal cache_proto, cache_version, cache
9599

96-
if proto_key != cache_proto_key:
100+
if (
101+
registry_proto is not cache_proto
102+
or registry_proto.version_id != cache_version
103+
):
97104
cache = {}
98-
cache_proto_key = proto_key
105+
cache_proto, cache_version = registry_proto, registry_proto.version_id
99106

100107
key = (project, name)
101108
if key in cache:

‎sdk/python/feast/on_demand_feature_view.py‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -858,16 +858,7 @@ def _handle_backward_compatible_udf(
858858
@classmethod
859859
def _parse_features_from_proto(cls, proto: OnDemandFeatureViewProto) -> List[Field]:
860860
"""Parse features from the protobuf representation."""
861-
return [
862-
Field(
863-
name=feature.name,
864-
dtype=from_value_type(ValueType(feature.value_type)),
865-
vector_index=feature.vector_index,
866-
vector_length=feature.vector_length,
867-
vector_search_metric=feature.vector_search_metric,
868-
)
869-
for feature in proto.spec.features
870-
]
861+
return [Field.from_proto(feature) for feature in proto.spec.features]
871862

872863
@classmethod
873864
def _parse_optional_fields_from_proto(cls, proto: OnDemandFeatureViewProto) -> dict:
@@ -1207,8 +1198,12 @@ def _feature_exists_in_inferred(
12071198
Returns:
12081199
True if the feature exists in the inferred features, False otherwise
12091200
"""
1210-
# Check for exact feature match first
1211-
if specified_feature in inferred_features:
1201+
# Inferred features carry only a name and a type, so ignore the
1202+
# description, tags and vector settings of the specified feature
1203+
if any(
1204+
f.name == specified_feature.name and f.dtype == specified_feature.dtype
1205+
for f in inferred_features
1206+
):
12121207
return True
12131208

12141209
# For array types, we need to check by name since array types

‎sdk/python/feast/templates/aws/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You can run the overall workflow with `python test_workflow.py`.
1010

1111
## To move from this into a more production ready workflow:
1212
1. `feature_store.yaml` points to a local file as a registry. You'll want to setup a remote file (e.g. in S3/GCS) or a
13-
SQL registry. See [registry docs](https://docs.feast.dev/getting-started/concepts/registry) for more details.
13+
SQL registry. See [registry docs](https://docs.feast.dev/getting-started/components/registry) for more details.
1414
2. Setup CI/CD + dev vs staging vs prod environments to automatically update the registry as you change Feast feature definitions. See [docs](https://docs.feast.dev/how-to-guides/running-feast-in-production#1.-automatically-deploying-changes-to-your-feature-definitions).
1515
3. (optional) Regularly scheduled materialization to power low latency feature retrieval (e.g. via Airflow). See [Batch data ingestion](https://docs.feast.dev/getting-started/concepts/data-ingestion#batch-data-ingestion)
1616
for more details.

‎sdk/python/feast/templates/gcp/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You can run the overall workflow with `python test_workflow.py`.
1010

1111
## To move from this into a more production ready workflow:
1212
1. `feature_store.yaml` points to a local file as a registry. You'll want to setup a remote file (e.g. in S3/GCS) or a
13-
SQL registry. See [registry docs](https://docs.feast.dev/getting-started/concepts/registry) for more details.
13+
SQL registry. See [registry docs](https://docs.feast.dev/getting-started/components/registry) for more details.
1414
2. This example uses an already setup BigQuery Feast data warehouse as the [offline store](https://docs.feast.dev/getting-started/components/offline-store)
1515
to generate training data. You'll need to connect your own BigQuery instance to make this work.
1616
3. Setup CI/CD + dev vs staging vs prod environments to automatically update the registry as you change Feast feature definitions. See [docs](https://docs.feast.dev/how-to-guides/running-feast-in-production#1.-automatically-deploying-changes-to-your-feature-definitions).

0 commit comments

Comments
 (0)