From a68a4efcfc41cf3b4caef44b6b67b1dc02e10932 Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Sun, 21 Jun 2026 22:56:01 -0400 Subject: [PATCH 01/11] feat: add Chronon online and offline store integrations Signed-off-by: Francisco Javier Arceo --- .../pr_chronon_integration_tests.yml | 124 ++++++ docs/SUMMARY.md | 3 + docs/reference/data-sources/chronon.md | 57 +++ docs/reference/offline-stores/chronon.md | 94 ++++ docs/reference/online-stores/chronon.md | 102 +++++ .../chronon/start-local-chronon-service.sh | 167 +++++++ .../chronon/stop-local-chronon-service.sh | 21 + sdk/python/feast/__init__.py | 4 + sdk/python/feast/infra/chronon_provider.py | 5 + .../contrib/chronon_offline_store/__init__.py | 1 + .../contrib/chronon_offline_store/chronon.py | 409 ++++++++++++++++++ .../chronon_offline_store/chronon_source.py | 171 ++++++++ .../chronon_online_store/__init__.py | 1 + .../chronon_online_store/chronon.py | 163 +++++++ sdk/python/feast/infra/provider.py | 1 + sdk/python/feast/repo_config.py | 2 + .../test_chronon_offline_store.py | 335 ++++++++++++++ .../online_store/test_chronon_online_store.py | 100 +++++ .../test_chronon_online_store_real_service.py | 67 +++ .../test_chronon_source.py | 105 +++++ .../test_chronon_online_store.py | 290 +++++++++++++ .../test_chronon_local_service_script.py | 40 ++ 22 files changed, 2262 insertions(+) create mode 100644 .github/workflows/pr_chronon_integration_tests.yml create mode 100644 docs/reference/data-sources/chronon.md create mode 100644 docs/reference/offline-stores/chronon.md create mode 100644 docs/reference/online-stores/chronon.md create mode 100755 infra/scripts/chronon/start-local-chronon-service.sh create mode 100755 infra/scripts/chronon/stop-local-chronon-service.sh create mode 100644 sdk/python/feast/infra/chronon_provider.py create mode 100644 sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/__init__.py create mode 100644 sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py create mode 100644 sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py create mode 100644 sdk/python/feast/infra/online_stores/chronon_online_store/__init__.py create mode 100644 sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py create mode 100644 sdk/python/tests/integration/offline_store/test_chronon_offline_store.py create mode 100644 sdk/python/tests/integration/online_store/test_chronon_online_store.py create mode 100644 sdk/python/tests/integration/online_store/test_chronon_online_store_real_service.py create mode 100644 sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_source.py create mode 100644 sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py create mode 100644 sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py diff --git a/.github/workflows/pr_chronon_integration_tests.yml b/.github/workflows/pr_chronon_integration_tests.yml new file mode 100644 index 00000000000..6e8019a0860 --- /dev/null +++ b/.github/workflows/pr_chronon_integration_tests.yml @@ -0,0 +1,124 @@ +name: pr-chronon-integration-tests + +on: + pull_request: + types: + - opened + - synchronize + - labeled + paths: + - "sdk/python/feast/infra/online_stores/chronon_online_store/**" + - "sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/**" + - "sdk/python/feast/infra/chronon_provider.py" + - "sdk/python/tests/unit/infra/online_stores/chronon_online_store/**" + - "sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/**" + - "sdk/python/tests/integration/online_store/test_chronon_online_store.py" + - "sdk/python/tests/integration/online_store/test_chronon_online_store_real_service.py" + - "sdk/python/tests/integration/offline_store/test_chronon_offline_store.py" + - "infra/scripts/chronon/**" + - "chronon/**" + - ".github/workflows/pr_chronon_integration_tests.yml" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + chronon-python-tests: + if: + ((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) || + (github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) && + github.event.pull_request.base.repo.full_name == 'feast-dev/feast' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ github.event.repository.full_name }} + ref: ${{ github.ref }} + token: ${{ secrets.GITHUB_TOKEN }} + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + architecture: x64 + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "8" + - name: Install dependencies + run: make install-python-dependencies-ci + - name: Checkout Chronon + env: + CHRONON_REPO: ${{ github.workspace }}/.chronon + CHRONON_REPO_URL: https://github.com/airbnb/chronon.git + CHRONON_REF: 6c0b8de9f0301521baf61a46ff3083c566fb4052 # pragma: allowlist secret + run: | + git clone "${CHRONON_REPO_URL}" "${CHRONON_REPO}" + git -C "${CHRONON_REPO}" checkout "${CHRONON_REF}" + - name: Install Chronon build dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + apt-transport-https \ + autoconf \ + automake \ + bison \ + build-essential \ + ca-certificates \ + curl \ + flex \ + g++ \ + gnupg \ + libtool \ + pkg-config \ + python3-pip \ + python3-venv + echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list + curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x99E82A75642AC823" | sudo apt-key add - + sudo apt-get update + sudo apt-get install -y sbt + curl -sSL "http://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.tar.gz" -o /tmp/thrift.tar.gz + sudo rm -rf /usr/src/thrift + sudo mkdir -p /usr/src/thrift + sudo tar zxf /tmp/thrift.tar.gz -C /usr/src/thrift --strip-components=1 + cd /usr/src/thrift + sudo ./configure --without-python --without-cpp + sudo make -j2 + sudo make install + python3 -m pip install --break-system-packages build + thrift -version + - name: Build Chronon quickstart and service jars + env: + CHRONON_REPO: ${{ github.workspace }}/.chronon + run: | + cd "${CHRONON_REPO}/quickstart/mongo-online-impl" + sbt assembly + cd "${CHRONON_REPO}" + sbt "project service" assembly + - name: Run Chronon unit and stub integration tests + run: | + uv run pytest -c sdk/python/pytest.ini \ + sdk/python/tests/unit/infra/online_stores/chronon_online_store \ + sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store \ + sdk/python/tests/integration/online_store/test_chronon_online_store.py \ + sdk/python/tests/integration/offline_store/test_chronon_offline_store.py \ + --integration + - name: Start live Chronon service + env: + CHRONON_REPO: ${{ github.workspace }}/.chronon + run: infra/scripts/chronon/start-local-chronon-service.sh + - name: Run Chronon live-service integration test + env: + CHRONON_SERVICE_URL: http://127.0.0.1:9000 + run: | + uv run pytest -c sdk/python/pytest.ini \ + sdk/python/tests/integration/online_store/test_chronon_online_store_real_service.py \ + --integration + - name: Stop live Chronon service + if: always() + run: infra/scripts/chronon/stop-local-chronon-service.sh diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index c94dd88708d..19716a0e87a 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -125,6 +125,7 @@ * [Clickhouse (contrib)](reference/data-sources/clickhouse.md) * [Ray (contrib)](reference/data-sources/ray.md) * [MongoDB (contrib)](reference/data-sources/mongodb.md) + * [Chronon (contrib)](reference/data-sources/chronon.md) * [Offline stores](reference/offline-stores/README.md) * [Overview](reference/offline-stores/overview.md) * [Dask](reference/offline-stores/dask.md) @@ -142,6 +143,7 @@ * [Oracle (contrib)](reference/offline-stores/oracle.md) * [Athena (contrib)](reference/offline-stores/athena.md) * [MongoDB (contrib)](reference/offline-stores/mongodb.md) + * [Chronon (contrib)](reference/offline-stores/chronon.md) * [Remote Offline](reference/offline-stores/remote-offline-store.md) * [Hybrid](reference/offline-stores/hybrid.md) * [Online stores](reference/online-stores/README.md) @@ -164,6 +166,7 @@ * [SingleStore](reference/online-stores/singlestore.md) * [Milvus](reference/online-stores/milvus.md) * [MongoDB](reference/online-stores/mongodb.md) + * [Chronon (contrib)](reference/online-stores/chronon.md) * [Elasticsearch](reference/online-stores/elasticsearch.md) * [Qdrant](reference/online-stores/qdrant.md) * [Faiss](reference/online-stores/faiss.md) diff --git a/docs/reference/data-sources/chronon.md b/docs/reference/data-sources/chronon.md new file mode 100644 index 00000000000..dfc5c934a33 --- /dev/null +++ b/docs/reference/data-sources/chronon.md @@ -0,0 +1,57 @@ +# Chronon source (contrib) + +## Description + +Chronon sources describe feature data produced by [Chronon](https://chronon.ai/) and consumed by Feast. +They point Feast at Chronon's offline materialization output and, when online reads are needed, identify the Chronon Join or GroupBy that should be queried from Chronon's online service. + +Feast does not compute or materialize Chronon features. Chronon owns feature computation, backfills, consistency, and online serving. Feast uses the source metadata for registry, discovery, historical retrieval, and online lookup. + +## Examples + +Defining a Chronon source for a Chronon Join: + +```python +from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( + ChrononSource, +) + +driver_stats_source = ChrononSource( + name="driver_stats", + materialization_path="data/chronon/driver_stats", + chronon_join="team/driver_stats.v1", + online_endpoint="http://localhost:8080", + timestamp_field="event_timestamp", + created_timestamp_column="created_timestamp", +) +``` + +Defining a Chronon source for a Chronon GroupBy: + +```python +driver_profile_source = ChrononSource( + name="driver_profile", + materialization_path="data/chronon/driver_profile", + chronon_group_by="team/driver_profile.v1", + timestamp_field="event_timestamp", +) +``` + +## Configuration reference + +| Parameter | Required | Description | +| :------------------------- | :------- | :---------- | +| `materialization_path` | yes | Local or repository-relative path to Chronon's Parquet materialization output. | +| `chronon_join` | no | Chronon Join name used for online reads, for example `team/training_set.v1`. | +| `chronon_group_by` | no | Chronon GroupBy name used for online reads, for example `team/user_features.v1`. | +| `online_endpoint` | no | Chronon online service base URL for this source. If omitted, Feast uses the Chronon online store `path`. | +| `timestamp_field` | yes | Event timestamp column in the materialized Chronon data. | +| `created_timestamp_column` | no | Optional created timestamp column used to select the latest row when duplicate event timestamps exist. | +| `field_mapping` | no | Standard Feast field mapping applied before retrieval. | + +Set at most one of `chronon_join` and `chronon_group_by`. Offline-only sources may omit both, but `online_endpoint` requires one of them so Feast can build the Chronon request URL. + +## Supported Types + +Chronon sources read Parquet data through PyArrow and use Feast's standard PyArrow type mapping. +For a comparison against other batch data sources, please see [here](overview.md#functionality-matrix). diff --git a/docs/reference/offline-stores/chronon.md b/docs/reference/offline-stores/chronon.md new file mode 100644 index 00000000000..1e8b73aabb7 --- /dev/null +++ b/docs/reference/offline-stores/chronon.md @@ -0,0 +1,94 @@ +# Chronon offline store (contrib) + +## Description + +The Chronon offline store provides support for reading [ChrononSources](../data-sources/chronon.md) from Chronon's Parquet materialization output. + +Chronon remains the system of record for feature computation and materialization. Feast reads Chronon-produced data for historical retrieval, feature reuse, and registry-driven training workflows. + +## Getting started + +Chronon-backed feature repos use the Chronon offline store with Chronon sources: + +{% code title="feature_store.yaml" %} +```yaml +project: my_project +registry: data/registry.db +provider: chronon +offline_store: + type: chronon +online_store: + type: chronon + path: http://localhost:8080 +``` +{% endcode %} + +Example feature view: + +```python +from feast import Entity, FeatureView, Field +from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( + ChrononSource, +) +from feast.types import Float32 + +driver = Entity(name="driver", join_keys=["driver_id"]) + +driver_stats = FeatureView( + name="driver_stats", + entities=[driver], + schema=[Field(name="rating", dtype=Float32)], + source=ChrononSource( + name="driver_stats_source", + materialization_path="data/chronon/driver_stats", + chronon_join="team/driver_stats.v1", + timestamp_field="event_timestamp", + created_timestamp_column="created_timestamp", + ), +) +``` + +## Historical retrieval + +`get_historical_features` performs point-in-time joins against Chronon's materialized Parquet data. For each entity row, Feast selects the latest Chronon row with an event timestamp at or before the entity timestamp. If `created_timestamp_column` is configured and duplicate event timestamps exist, the latest created row wins. + +This is intended for training and validation workflows that want Feast's registry and retrieval APIs while using Chronon as the feature computation engine. + +## Configuration reference + +| Parameter | Required | Default | Description | +| :-------- | :------- | :------ | :---------- | +| `type` | yes | - | Must be set to `chronon`. | +| `path` | no | - | Reserved for future offline store configuration. Source-level `materialization_path` controls where data is read from. | + +## Functionality Matrix + +The set of functionality supported by offline stores is described in detail [here](overview.md#functionality). +Below is a matrix indicating which functionality is supported by the Chronon offline store. + +| | Chronon | +| :----------------------------------------------------------------- | :------ | +| `get_historical_features` (point-in-time correct join) | yes | +| `pull_latest_from_table_or_query` (retrieve latest feature values) | yes | +| `pull_all_from_table_or_query` (retrieve a saved dataset) | yes | +| `offline_write_batch` (persist dataframes to offline store) | no | +| `write_logged_features` (persist logged features to offline store) | no | + +Below is a matrix indicating which functionality is supported by `ChrononRetrievalJob`. + +| | Chronon | +| ----------------------------------------------------- | ------- | +| export to dataframe | yes | +| export to arrow table | yes | +| export to arrow batches | no | +| export to SQL | no | +| export to data lake (S3, GCS, etc.) | no | +| export to data warehouse | no | +| export as Spark dataframe | no | +| local execution of Python-based on-demand transforms | no | +| remote execution of Python-based on-demand transforms | no | +| persist results in the offline store | no | +| preview the query plan before execution | no | +| read partitioned data | yes | + +To compare this set of functionality against other offline stores, please see the full [functionality matrix](overview.md#functionality-matrix). diff --git a/docs/reference/online-stores/chronon.md b/docs/reference/online-stores/chronon.md new file mode 100644 index 00000000000..245f35d94bb --- /dev/null +++ b/docs/reference/online-stores/chronon.md @@ -0,0 +1,102 @@ +# Chronon online store (contrib) + +## Description + +The [Chronon](https://chronon.ai/) online store lets Feast read online features from a Chronon service. + +This integration is a bridge, not a Feast-managed online store. Chronon owns materialization and serving. Feast builds Chronon request URLs from `ChrononSource` metadata and converts Chronon responses into Feast values for `get_online_features`. + +## Getting started + +Configure the Chronon online store with the base URL of your Chronon service: + +{% code title="feature_store.yaml" %} +```yaml +project: my_project +registry: data/registry.db +provider: chronon +offline_store: + type: chronon +online_store: + type: chronon + path: http://localhost:8080 + timeout: 30 + verify_ssl: true +``` +{% endcode %} + +Each online feature view must use a `ChrononSource` with exactly one of `chronon_join` or `chronon_group_by`: + +```python +source = ChrononSource( + name="driver_stats_source", + materialization_path="data/chronon/driver_stats", + chronon_join="team/driver_stats.v1", + online_endpoint="https://chronon.example.com", + timestamp_field="event_timestamp", +) +``` + +If `online_endpoint` is set on the source, it overrides the online store `path` for that feature view. + +## Request routing + +Feast builds Chronon URLs from the source metadata: + +| Source field | URL shape | +| :----------------- | :-------- | +| `chronon_join` | `/v1/features/join/{quoted_chronon_join}` | +| `chronon_group_by` | `/v1/features/groupby/{quoted_chronon_group_by}` | + +The request body is a list of entity rows. Chronon responses are expected to be JSON objects with a `results` list whose length matches the number of requested entity keys. Rows with non-success statuses are returned as missing feature rows. + +## Local service testing + +The repository includes `infra/scripts/chronon/start-local-chronon-service.sh` for live integration testing against Chronon's quickstart service. The script expects a local [airbnb/chronon](https://github.com/airbnb/chronon) checkout with the quickstart Mongo implementation and service jars built. + +Use `CHRONON_REPO` when the Chronon checkout is not located at `/chronon`: + +```bash +CHRONON_REPO=/path/to/chronon infra/scripts/chronon/start-local-chronon-service.sh +``` + +For a preflight-only check: + +```bash +CHRONON_PREFLIGHT_ONLY=1 CHRONON_REPO=/path/to/chronon infra/scripts/chronon/start-local-chronon-service.sh +``` + +## Configuration reference + +| Parameter | Required | Default | Description | +| :----------- | :------- | :---------------------- | :---------- | +| `type` | yes | `chronon` | Must be set to `chronon`. | +| `path` | no | `http://localhost:8080` | Chronon online service base URL. | +| `timeout` | no | `30` | HTTP request timeout in seconds. | +| `verify_ssl` | no | `true` | Whether TLS certificates are verified for HTTPS requests. | + +## Functionality Matrix + +The set of functionality supported by online stores is described in detail [here](overview.md#functionality). +Below is a matrix indicating which functionality is supported by the Chronon online store. + +| | Chronon | +| :-------------------------------------------------------- | :------ | +| write feature values to the online store | no | +| read feature values from the online store | yes | +| update infrastructure (e.g. tables) in the online store | no | +| teardown infrastructure (e.g. tables) in the online store | no | +| generate a plan of infrastructure changes | no | +| support for on-demand transforms | no | +| readable by Python SDK | yes | +| readable by Java | no | +| readable by Go | no | +| support for entityless feature views | no | +| support for concurrent writing to the same key | n/a | +| support for ttl (time to live) at retrieval | Chronon | +| support for deleting expired data | Chronon | +| collocated by feature view | Chronon | +| collocated by feature service | Chronon | +| collocated by entity key | Chronon | + +To compare this set of functionality against other online stores, please see the full [functionality matrix](overview.md#functionality-matrix). diff --git a/infra/scripts/chronon/start-local-chronon-service.sh b/infra/scripts/chronon/start-local-chronon-service.sh new file mode 100755 index 00000000000..f0b5184cc66 --- /dev/null +++ b/infra/scripts/chronon/start-local-chronon-service.sh @@ -0,0 +1,167 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" +CHRONON_DIR="${CHRONON_REPO:-${ROOT_DIR}/chronon}" + +MONGO_CONTAINER="${CHRONON_MONGO_CONTAINER:-chronon-mongo}" +MAIN_CONTAINER="${CHRONON_MAIN_CONTAINER:-chronon-main}" +NETWORK_NAME="${CHRONON_NETWORK:-chronon-net}" +SERVICE_PORT="${CHRONON_SERVICE_PORT:-9000}" +SERVICE_HOST="${CHRONON_SERVICE_HOST:-127.0.0.1}" +SERVICE_PID_FILE="${CHRONON_SERVICE_PID_FILE:-/tmp/chronon-service.pid}" +SERVICE_LOG_FILE="${CHRONON_SERVICE_LOG_FILE:-/tmp/chronon-service.log}" +JAVA_BIN="${JAVA_BIN:-java}" +CHRONON_PREFLIGHT_ONLY="${CHRONON_PREFLIGHT_ONLY:-0}" +MONGO_IMPL_JAR="${CHRONON_DIR}/quickstart/mongo-online-impl/target/scala-2.12/mongo-online-impl-assembly-0.1.0-SNAPSHOT.jar" +SERVICE_JAR="${CHRONON_DIR}/service/target/scala-2.12/service-0.0.111-SNAPSHOT.jar" + +print_setup_help() { + cat >&2 <&2 + print_setup_help + exit 1 +fi + +if [[ ! -f "${MONGO_IMPL_JAR}" ]]; then + echo "Missing quickstart Mongo implementation jar at ${MONGO_IMPL_JAR}." >&2 + print_setup_help + exit 1 +fi + +if [[ ! -f "${SERVICE_JAR}" ]]; then + echo "Missing Chronon service jar at ${SERVICE_JAR}." >&2 + print_setup_help + exit 1 +fi + +if [[ "${CHRONON_PREFLIGHT_ONLY}" == "1" ]]; then + echo "Chronon local service preflight passed for CHRONON_REPO=${CHRONON_DIR}" + exit 0 +fi + +cleanup_stale_service() { + if [[ -f "${SERVICE_PID_FILE}" ]]; then + local pid + pid="$(cat "${SERVICE_PID_FILE}")" + if kill -0 "${pid}" >/dev/null 2>&1; then + kill "${pid}" >/dev/null 2>&1 || true + wait "${pid}" 2>/dev/null || true + fi + rm -f "${SERVICE_PID_FILE}" + fi +} + +wait_for_mongo() { + local attempts=60 + until docker exec "${MONGO_CONTAINER}" mongosh --quiet --eval 'db.runCommand({ ping: 1 }).ok' >/dev/null 2>&1; do + attempts=$((attempts - 1)) + if [[ "${attempts}" -le 0 ]]; then + echo "Mongo did not become ready in time." >&2 + exit 1 + fi + sleep 2 + done +} + +wait_for_data_load() { + local attempts=90 + until docker logs "${MAIN_CONTAINER}" 2>&1 | grep -q "Spark session available as 'spark'"; do + attempts=$((attempts - 1)) + if [[ "${attempts}" -le 0 ]]; then + echo "Chronon quickstart data loader did not initialize Spark in time." >&2 + exit 1 + fi + sleep 2 + done +} + +wait_for_http() { + local url="$1" + local attempts=60 + until curl --fail --silent "${url}" >/dev/null; do + attempts=$((attempts - 1)) + if [[ "${attempts}" -le 0 ]]; then + echo "Chronon service did not become ready at ${url}." >&2 + exit 1 + fi + sleep 2 + done +} + +run_quickstart_online_prep() { + docker exec "${MAIN_CONTAINER}" bash -lc ' + set -euo pipefail + cd /srv/chronon + run.py --conf production/group_bys/quickstart/purchases.v1 --mode upload --ds 2023-12-01 + run.py --conf production/group_bys/quickstart/returns.v1 --mode upload --ds 2023-12-01 + /opt/spark/bin/spark-submit --class ai.chronon.quickstart.online.Spark2MongoLoader --master local[*] /srv/onlineImpl/target/scala-2.12/mongo-online-impl-assembly-0.1.0-SNAPSHOT.jar default.quickstart_purchases_v1_upload mongodb://admin:admin@'"${MONGO_CONTAINER}"':27017/?authSource=admin # pragma: allowlist secret + /opt/spark/bin/spark-submit --class ai.chronon.quickstart.online.Spark2MongoLoader --master local[*] /srv/onlineImpl/target/scala-2.12/mongo-online-impl-assembly-0.1.0-SNAPSHOT.jar default.quickstart_returns_v1_upload mongodb://admin:admin@'"${MONGO_CONTAINER}"':27017/?authSource=admin # pragma: allowlist secret + run.py --mode metadata-upload --conf production/joins/quickstart/training_set.v2 --ds 2023-12-01 + run.py --mode fetch --type join --name quickstart/training_set.v2 -k "{\"user_id\":\"5\"}" + ' +} + +cleanup_stale_service +(docker network inspect "${NETWORK_NAME}" >/dev/null 2>&1) || docker network create "${NETWORK_NAME}" >/dev/null +(docker rm -f "${MONGO_CONTAINER}" >/dev/null 2>&1) || true +(docker rm -f "${MAIN_CONTAINER}" >/dev/null 2>&1) || true + +docker run -d \ + --name "${MONGO_CONTAINER}" \ + --network "${NETWORK_NAME}" \ + -p 27017:27017 \ + -e MONGO_INITDB_ROOT_USERNAME=admin \ + -e MONGO_INITDB_ROOT_PASSWORD=admin \ + mongo:latest >/dev/null + +wait_for_mongo + +docker run -d \ + --name "${MAIN_CONTAINER}" \ + --network "${NETWORK_NAME}" \ + -p 4040:4040 \ + -e USER=root \ + -e SPARK_SUBMIT_PATH=/opt/spark/bin/spark-submit \ + -e PYTHONPATH=/srv/chronon \ + -e SPARK_VERSION=3.1.1 \ + -e JOB_MODE='local[*]' \ + -e PARALLELISM=2 \ + -e EXECUTOR_MEMORY=2G \ + -e EXECUTOR_CORES=4 \ + -e DRIVER_MEMORY=1G \ + -e CHRONON_LOG_TABLE=default.chronon_log_table \ + -e CHRONON_ONLINE_CLASS=ai.chronon.quickstart.online.ChrononMongoOnlineImpl \ + -e "CHRONON_ONLINE_ARGS=-Zuser=admin -Zpassword=admin -Zhost=${MONGO_CONTAINER} -Zport=27017 -Zdatabase=admin" \ + -v "${CHRONON_DIR}/quickstart/mongo-online-impl:/srv/onlineImpl" \ + ezvz/chronon \ + bash -lc '/opt/spark/bin/spark-shell -i scripts/data-loader.scala && tail -f /dev/null' >/dev/null + +wait_for_data_load +run_quickstart_online_prep + +: > "${SERVICE_LOG_FILE}" +( + cd "${CHRONON_DIR}" + exec "${JAVA_BIN}" -jar service/target/scala-2.12/service-0.0.111-SNAPSHOT.jar \ + run ai.chronon.service.WebServiceVerticle \ + -Dserver.port="${SERVICE_PORT}" \ + -conf service/src/main/resources/example_config.json +) >"${SERVICE_LOG_FILE}" 2>&1 & + +echo "$!" > "${SERVICE_PID_FILE}" +wait_for_http "http://${SERVICE_HOST}:${SERVICE_PORT}/ping" + +echo "CHRONON_SERVICE_URL=http://${SERVICE_HOST}:${SERVICE_PORT}" diff --git a/infra/scripts/chronon/stop-local-chronon-service.sh b/infra/scripts/chronon/stop-local-chronon-service.sh new file mode 100755 index 00000000000..4aceed23659 --- /dev/null +++ b/infra/scripts/chronon/stop-local-chronon-service.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -euo pipefail + +MONGO_CONTAINER="${CHRONON_MONGO_CONTAINER:-chronon-mongo}" +MAIN_CONTAINER="${CHRONON_MAIN_CONTAINER:-chronon-main}" +NETWORK_NAME="${CHRONON_NETWORK:-chronon-net}" +SERVICE_PID_FILE="${CHRONON_SERVICE_PID_FILE:-/tmp/chronon-service.pid}" + +if [[ -f "${SERVICE_PID_FILE}" ]]; then + pid="$(cat "${SERVICE_PID_FILE}")" + if kill -0 "${pid}" >/dev/null 2>&1; then + kill "${pid}" >/dev/null 2>&1 || true + wait "${pid}" 2>/dev/null || true + fi + rm -f "${SERVICE_PID_FILE}" +fi + +(docker rm -f "${MAIN_CONTAINER}" >/dev/null 2>&1) || true +(docker rm -f "${MONGO_CONTAINER}" >/dev/null 2>&1) || true +(docker network rm "${NETWORK_NAME}" >/dev/null 2>&1) || true diff --git a/sdk/python/feast/__init__.py b/sdk/python/feast/__init__.py index 30925e9fc4a..0d30a672aa0 100644 --- a/sdk/python/feast/__init__.py +++ b/sdk/python/feast/__init__.py @@ -6,6 +6,9 @@ from feast.infra.offline_stores.contrib.athena_offline_store.athena_source import ( AthenaSource, ) +from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( + ChrononSource, +) from feast.infra.offline_stores.contrib.oracle_offline_store.oracle_source import ( OracleSource, ) @@ -69,6 +72,7 @@ "RequestSource", "AthenaSource", "OracleSource", + "ChrononSource", "Project", "FeastVectorStore", "DocEmbedder", diff --git a/sdk/python/feast/infra/chronon_provider.py b/sdk/python/feast/infra/chronon_provider.py new file mode 100644 index 00000000000..6df8881e387 --- /dev/null +++ b/sdk/python/feast/infra/chronon_provider.py @@ -0,0 +1,5 @@ +from feast.infra.passthrough_provider import PassthroughProvider + + +class ChrononProvider(PassthroughProvider): + """Optional provider wrapper for Chronon-backed Feast configurations.""" diff --git a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/__init__.py b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/__init__.py new file mode 100644 index 00000000000..89b3ae12bf6 --- /dev/null +++ b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/__init__.py @@ -0,0 +1 @@ +__all__ = ["ChrononOfflineStore", "ChrononOfflineStoreConfig", "ChrononSource"] diff --git a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py new file mode 100644 index 00000000000..c99210c8618 --- /dev/null +++ b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py @@ -0,0 +1,409 @@ +from datetime import datetime +from pathlib import Path +from typing import Any, Callable, List, Literal, Optional, Union + +import pandas as pd +import pyarrow as pa +from pydantic import StrictStr + +from feast import utils +from feast.data_source import DataSource +from feast.feature_logging import LoggingConfig, LoggingSource +from feast.feature_view import FeatureView +from feast.infra.offline_stores.file_source import FileSource +from feast.infra.offline_stores.offline_store import ( + OfflineStore, + RetrievalJob, + RetrievalMetadata, +) +from feast.infra.offline_stores.offline_utils import ( + DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL, + assert_expected_columns_in_entity_df, + get_expected_join_keys, +) +from feast.infra.registry.base_registry import BaseRegistry +from feast.on_demand_feature_view import OnDemandFeatureView +from feast.repo_config import FeastConfigBaseModel, RepoConfig +from feast.saved_dataset import SavedDatasetStorage + + +class ChrononOfflineStoreConfig(FeastConfigBaseModel): + type: Literal["chronon"] = "chronon" + path: Optional[StrictStr] = None + + +class ChrononRetrievalJob(RetrievalJob): + def __init__( + self, + evaluation_function: Callable[[], pd.DataFrame], + full_feature_names: bool, + metadata: Optional[RetrievalMetadata] = None, + ): + self.evaluation_function = evaluation_function + self._full_feature_names = full_feature_names + self._metadata = metadata + + @property + def full_feature_names(self) -> bool: + return self._full_feature_names + + @property + def on_demand_feature_views(self) -> List[OnDemandFeatureView]: + return [] + + def _to_df_internal(self, timeout: Optional[int] = None) -> pd.DataFrame: + return self.evaluation_function().reset_index(drop=True) + + def _to_arrow_internal(self, timeout: Optional[int] = None) -> pa.Table: + return pa.Table.from_pandas(self._to_df_internal(timeout=timeout)) + + def persist( + self, + storage: SavedDatasetStorage, + allow_overwrite: bool = False, + timeout: Optional[int] = None, + ): + raise NotImplementedError( + "ChrononRetrievalJob does not currently support persisted saved datasets." + ) + + @property + def metadata(self) -> Optional[RetrievalMetadata]: + return self._metadata + + +def _get_chronon_source(feature_view: FeatureView): + source = feature_view.batch_source + if source is None or source.__class__.__name__ != "ChrononSource": + raise ValueError( + f"Feature view '{feature_view.name}' is not backed by a ChrononSource." + ) + return source + + +def _load_materialized_dataframe( + config: RepoConfig, feature_view: FeatureView +) -> pd.DataFrame: + source = _get_chronon_source(feature_view) + resolved_path = FileSource.get_uri_for_file_path( + repo_path=config.repo_path, uri=source.materialization_path + ) + dataframe = pd.read_parquet(resolved_path) + if source.field_mapping: + dataframe = dataframe.rename(columns=source.field_mapping) + return utils.make_df_tzaware(dataframe) + + +def _output_feature_name( + feature_view: FeatureView, feature_name: str, full_feature_names: bool +) -> str: + if full_feature_names: + return f"{feature_view.projection.name_to_use()}__{feature_name}" + return feature_name + + +def _get_required_timestamp_field(feature_view: FeatureView) -> str: + source = _get_chronon_source(feature_view) + timestamp_field = source.timestamp_field + if not timestamp_field: + raise ValueError( + f"ChrononSource for feature view '{feature_view.name}' must define " + "`timestamp_field` for historical retrieval." + ) + return timestamp_field + + +class ChrononOfflineStore(OfflineStore): + @staticmethod + def get_historical_features( + config: RepoConfig, + feature_views: List[FeatureView], + feature_refs: List[str], + entity_df: Optional[Union[pd.DataFrame, str]], + registry: BaseRegistry, + project: str, + full_feature_names: bool = False, + **kwargs, + ) -> RetrievalJob: + assert isinstance(config.offline_store, ChrononOfflineStoreConfig) + + requested_features, requested_odfvs = ( + utils._get_requested_feature_views_to_features_dict( + feature_refs, + feature_views, + registry.list_on_demand_feature_views(project), + ) + ) + if requested_odfvs: + raise ValueError( + "ChrononOfflineStore does not support on-demand feature views." + ) + if entity_df is not None and not isinstance(entity_df, pd.DataFrame): + raise ValueError( + "ChrononOfflineStore currently supports pandas entity_df inputs or " + "time-range retrieval without entity_df." + ) + + metadata = RetrievalMetadata( + features=feature_refs, + keys=( + list(entity_df.columns) + if isinstance(entity_df, pd.DataFrame) + else [DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL] + ), + min_event_timestamp=kwargs.get("start_date"), + max_event_timestamp=kwargs.get("end_date"), + ) + + if entity_df is None: + if len(requested_features) != 1: + raise ValueError( + "ChrononOfflineStore non-entity retrieval currently supports " + "exactly one feature view at a time." + ) + + def evaluate_non_entity_retrieval() -> pd.DataFrame: + feature_view, selected_features = next(iter(requested_features.items())) + dataframe = _load_materialized_dataframe(config, feature_view) + timestamp_col = _get_required_timestamp_field(feature_view) + start_date = kwargs.get("start_date") + end_date = kwargs.get("end_date") + if start_date is not None: + dataframe = dataframe[ + dataframe[timestamp_col] >= utils.make_tzaware(start_date) + ] + if end_date is not None: + dataframe = dataframe[ + dataframe[timestamp_col] <= utils.make_tzaware(end_date) + ] + keep_columns = [ + *(entity.name for entity in feature_view.entity_columns), + timestamp_col, + *(selected_features), + ] + dataframe = dataframe.loc[ + :, [c for c in keep_columns if c in dataframe.columns] + ] + rename_map = { + feature: _output_feature_name( + feature_view, feature, full_feature_names + ) + for feature in selected_features + } + return dataframe.rename(columns=rename_map) + + return ChrononRetrievalJob( + evaluation_function=evaluate_non_entity_retrieval, + full_feature_names=full_feature_names, + metadata=metadata, + ) + + entity_df = utils.make_df_tzaware(entity_df) + entity_event_timestamp_col = DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL + expected_join_keys = get_expected_join_keys(project, feature_views, registry) + assert_expected_columns_in_entity_df( + entity_df.dtypes.to_dict(), + expected_join_keys, + entity_event_timestamp_col, + ) + + def evaluate_historical_retrieval() -> pd.DataFrame: + result = entity_df.copy() + for feature_view, selected_features in requested_features.items(): + source = _get_chronon_source(feature_view) + source_df = _load_materialized_dataframe(config, feature_view) + timestamp_col = _get_required_timestamp_field(feature_view) + created_col = source.created_timestamp_column + left_keys = [] + right_keys = [] + for entity_column in feature_view.entity_columns: + left_keys.append( + feature_view.projection.join_key_map.get( + entity_column.name, entity_column.name + ) + ) + right_keys.append(entity_column.name) + + sort_columns = right_keys + [timestamp_col] + if created_col and created_col in source_df.columns: + sort_columns.append(created_col) + source_df = source_df.sort_values(sort_columns).drop_duplicates( + subset=right_keys + [timestamp_col], keep="last" + ) + + merge_columns = right_keys + [timestamp_col] + list(selected_features) + merge_frame = source_df.loc[ + :, [col for col in merge_columns if col in source_df.columns] + ].copy() + rename_map = dict(zip(right_keys, left_keys)) + rename_map.update( + { + feature: _output_feature_name( + feature_view, feature, full_feature_names + ) + for feature in selected_features + } + ) + merge_frame = merge_frame.rename(columns=rename_map) + row_id_col = "__chronon_row_id" + result = result.assign(**{row_id_col: range(len(result))}) + if result.empty: + for feature in selected_features: + output_column = _output_feature_name( + feature_view, feature, full_feature_names + ) + dtype = ( + source_df[feature].dtype + if feature in source_df.columns + else "object" + ) + result[output_column] = pd.Series(dtype=dtype) + result = result.drop(columns=[row_id_col]) + continue + right_groups = { + key if isinstance(key, tuple) else (key,): group.drop( + columns=left_keys, errors="ignore" + ) + for key, group in merge_frame.groupby( + left_keys, sort=False, dropna=False + ) + } + joined_frames = [] + for key, left_group in result.groupby( + left_keys, sort=False, dropna=False + ): + group_key = key if isinstance(key, tuple) else (key,) + right_group = right_groups.get(group_key, merge_frame.iloc[0:0]) + right_group = right_group.drop(columns=left_keys, errors="ignore") + joined = pd.merge_asof( + left_group.sort_values(entity_event_timestamp_col), + right_group.sort_values(timestamp_col), + left_on=entity_event_timestamp_col, + right_on=timestamp_col, + direction="backward", + ) + joined_frames.append(joined) + + result = ( + pd.concat(joined_frames, ignore_index=True) + .sort_values(row_id_col) + .drop(columns=[row_id_col]) + .reset_index(drop=True) + ) + if ( + timestamp_col != entity_event_timestamp_col + and timestamp_col in result.columns + ): + result = result.drop(columns=[timestamp_col]) + return result + + return ChrononRetrievalJob( + evaluation_function=evaluate_historical_retrieval, + full_feature_names=full_feature_names, + metadata=metadata, + ) + + @staticmethod + def pull_latest_from_table_or_query( + config: RepoConfig, + data_source: DataSource, + join_key_columns: List[str], + feature_name_columns: List[str], + timestamp_field: str, + created_timestamp_column: Optional[str], + start_date: datetime, + end_date: datetime, + ) -> RetrievalJob: + if data_source.__class__.__name__ != "ChrononSource": + raise ValueError("ChrononOfflineStore only supports ChrononSource inputs.") + + def evaluate_pull_latest() -> pd.DataFrame: + feature_view = FeatureView( + name=data_source.name, + entities=[], + schema=[], + source=data_source, + ) + dataframe = _load_materialized_dataframe(config, feature_view) + dataframe = dataframe[ + (dataframe[timestamp_field] >= utils.make_tzaware(start_date)) + & (dataframe[timestamp_field] <= utils.make_tzaware(end_date)) + ] + sort_columns = [timestamp_field] + if ( + created_timestamp_column + and created_timestamp_column in dataframe.columns + ): + sort_columns.append(created_timestamp_column) + dataframe = dataframe.sort_values(sort_columns).drop_duplicates( + subset=join_key_columns, keep="last" + ) + return dataframe[ + join_key_columns + feature_name_columns + [timestamp_field] + ] + + return ChrononRetrievalJob( + evaluation_function=evaluate_pull_latest, + full_feature_names=False, + ) + + @staticmethod + def pull_all_from_table_or_query( + config: RepoConfig, + data_source: DataSource, + join_key_columns: List[str], + feature_name_columns: List[str], + timestamp_field: str, + created_timestamp_column: Optional[str] = None, + start_date: Optional[datetime] = None, + end_date: Optional[datetime] = None, + ) -> RetrievalJob: + if data_source.__class__.__name__ != "ChrononSource": + raise ValueError("ChrononOfflineStore only supports ChrononSource inputs.") + + def evaluate_pull_all() -> pd.DataFrame: + feature_view = FeatureView( + name=data_source.name, + entities=[], + schema=[], + source=data_source, + ) + dataframe = _load_materialized_dataframe(config, feature_view) + if start_date is not None: + dataframe = dataframe[ + dataframe[timestamp_field] >= utils.make_tzaware(start_date) + ] + if end_date is not None: + dataframe = dataframe[ + dataframe[timestamp_field] <= utils.make_tzaware(end_date) + ] + keep_columns = join_key_columns + feature_name_columns + [timestamp_field] + return dataframe.loc[:, [c for c in keep_columns if c in dataframe.columns]] + + return ChrononRetrievalJob( + evaluation_function=evaluate_pull_all, + full_feature_names=False, + ) + + @staticmethod + def write_logged_features( + config: RepoConfig, + data: Union[pa.Table, Path], + source: LoggingSource, + logging_config: LoggingConfig, + registry: BaseRegistry, + ): + raise NotImplementedError( + "ChrononOfflineStore does not support Feast-managed logged feature writes." + ) + + @staticmethod + def offline_write_batch( + config: RepoConfig, + feature_view: FeatureView, + table: pa.Table, + progress: Optional[Callable[[int], Any]], + ): + raise NotImplementedError( + "ChrononOfflineStore does not support Feast-managed offline writes." + ) diff --git a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py new file mode 100644 index 00000000000..f3230736aba --- /dev/null +++ b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py @@ -0,0 +1,171 @@ +import json +from pathlib import Path +from typing import Any, Callable, Dict, Iterable, Optional, Tuple + +import pyarrow.dataset as ds + +from feast import type_map +from feast.data_source import DataSource +from feast.infra.offline_stores.file_source import FileSource +from feast.protos.feast.core.DataSource_pb2 import DataSource as DataSourceProto +from feast.repo_config import RepoConfig +from feast.value_type import ValueType + + +class ChrononOptions: + def __init__( + self, + *, + materialization_path: str, + chronon_group_by: Optional[str] = None, + chronon_join: Optional[str] = None, + online_endpoint: Optional[str] = None, + ): + self.materialization_path = materialization_path + self.chronon_group_by = chronon_group_by or "" + self.chronon_join = chronon_join or "" + self.online_endpoint = online_endpoint or "" + + @classmethod + def from_proto(cls, proto: DataSourceProto.CustomSourceOptions): + config = json.loads(proto.configuration.decode("utf8")) + return cls( + materialization_path=config["materialization_path"], + chronon_group_by=config.get("chronon_group_by"), + chronon_join=config.get("chronon_join"), + online_endpoint=config.get("online_endpoint"), + ) + + def to_proto(self) -> DataSourceProto.CustomSourceOptions: + return DataSourceProto.CustomSourceOptions( + configuration=json.dumps( + { + "materialization_path": self.materialization_path, + "chronon_group_by": self.chronon_group_by, + "chronon_join": self.chronon_join, + "online_endpoint": self.online_endpoint, + } + ).encode() + ) + + +class ChrononSource(DataSource): + def source_type(self) -> DataSourceProto.SourceType.ValueType: + return DataSourceProto.CUSTOM_SOURCE + + def __init__( + self, + *, + materialization_path: str, + name: Optional[str] = None, + chronon_group_by: Optional[str] = None, + chronon_join: Optional[str] = None, + online_endpoint: Optional[str] = None, + timestamp_field: Optional[str] = "", + created_timestamp_column: Optional[str] = "", + field_mapping: Optional[Dict[str, str]] = None, + description: Optional[str] = "", + tags: Optional[Dict[str, str]] = None, + owner: Optional[str] = "", + ): + if not materialization_path: + raise ValueError("ChrononSource requires `materialization_path`.") + if not timestamp_field: + raise ValueError("ChrononSource requires `timestamp_field`.") + if chronon_join and chronon_group_by: + raise ValueError( + "ChrononSource must define exactly one of `chronon_join` or " + "`chronon_group_by`, not both." + ) + if online_endpoint and not (chronon_join or chronon_group_by): + raise ValueError( + "`online_endpoint` requires `chronon_join` or `chronon_group_by`." + ) + + self._chronon_options = ChrononOptions( + materialization_path=materialization_path, + chronon_group_by=chronon_group_by, + chronon_join=chronon_join, + online_endpoint=online_endpoint, + ) + + super().__init__( + name=name or materialization_path, + timestamp_field=timestamp_field, + created_timestamp_column=created_timestamp_column, + field_mapping=field_mapping, + description=description, + tags=tags, + owner=owner, + ) + + @property + def materialization_path(self) -> str: + return self._chronon_options.materialization_path + + @property + def chronon_group_by(self) -> str: + return self._chronon_options.chronon_group_by + + @property + def chronon_join(self) -> str: + return self._chronon_options.chronon_join + + @property + def online_endpoint(self) -> str: + return self._chronon_options.online_endpoint + + @staticmethod + def from_proto(data_source: DataSourceProto) -> Any: + assert data_source.HasField("custom_options") + options = ChrononOptions.from_proto(data_source.custom_options) + return ChrononSource( + name=data_source.name, + materialization_path=options.materialization_path, + chronon_group_by=options.chronon_group_by, + chronon_join=options.chronon_join, + online_endpoint=options.online_endpoint, + field_mapping=dict(data_source.field_mapping), + timestamp_field=data_source.timestamp_field, + created_timestamp_column=data_source.created_timestamp_column, + description=data_source.description, + tags=dict(data_source.tags), + owner=data_source.owner, + ) + + def _to_proto_impl(self) -> DataSourceProto: + proto = DataSourceProto( + name=self.name, + type=DataSourceProto.CUSTOM_SOURCE, + data_source_class_type="feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source.ChrononSource", + field_mapping=self.field_mapping, + custom_options=self._chronon_options.to_proto(), + description=self.description, + tags=self.tags, + owner=self.owner, + ) + proto.timestamp_field = self.timestamp_field + proto.created_timestamp_column = self.created_timestamp_column + return proto + + def validate(self, config: RepoConfig): + resolved_path = FileSource.get_uri_for_file_path( + repo_path=config.repo_path, uri=self.materialization_path + ) + if not Path(resolved_path).exists(): + raise FileNotFoundError( + f"Chronon materialization path does not exist: {resolved_path}" + ) + + @staticmethod + def source_datatype_to_feast_value_type() -> Callable[[str], ValueType]: + return type_map.pa_to_feast_value_type + + def get_table_column_names_and_types( + self, config: RepoConfig + ) -> Iterable[Tuple[str, str]]: + resolved_path = FileSource.get_uri_for_file_path( + repo_path=config.repo_path, uri=self.materialization_path + ) + schema = ds.dataset(resolved_path, format="parquet").schema + return [(field.name, str(field.type)) for field in schema] diff --git a/sdk/python/feast/infra/online_stores/chronon_online_store/__init__.py b/sdk/python/feast/infra/online_stores/chronon_online_store/__init__.py new file mode 100644 index 00000000000..fd29e9d0b0a --- /dev/null +++ b/sdk/python/feast/infra/online_stores/chronon_online_store/__init__.py @@ -0,0 +1 @@ +__all__ = ["ChrononOnlineStore", "ChrononOnlineStoreConfig"] diff --git a/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py b/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py new file mode 100644 index 00000000000..aacdb87b1b3 --- /dev/null +++ b/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py @@ -0,0 +1,163 @@ +from datetime import datetime +from typing import Any, Callable, Dict, List, Literal, Optional, Tuple +from urllib.parse import quote + +from pydantic import StrictInt, StrictStr + +from feast.data_source import DataSource +from feast.feature_view import FeatureView +from feast.infra.online_stores.online_store import OnlineStore +from feast.permissions.client.http_auth_requests_wrapper import HttpSessionManager +from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto +from feast.protos.feast.types.Value_pb2 import Value as ValueProto +from feast.repo_config import FeastConfigBaseModel, RepoConfig +from feast.type_map import ( + feast_value_type_to_python_type, + python_values_to_proto_values, +) +from feast.value_type import ValueType + + +class ChrononOnlineStoreConfig(FeastConfigBaseModel): + type: Literal["chronon"] = "chronon" + path: StrictStr = "http://localhost:8080" + timeout: StrictInt = 30 + verify_ssl: bool = True + + +class ChrononOnlineStore(OnlineStore): + @staticmethod + def _get_chronon_source(table: FeatureView): + source: Optional[DataSource] = getattr(table, "batch_source", None) + if source is None or source.__class__.__name__ != "ChrononSource": + raise ValueError( + f"Feature view '{table.name}' is not backed by a ChrononSource." + ) + return source + + @staticmethod + def _build_url(config: RepoConfig, table: FeatureView) -> str: + source = ChrononOnlineStore._get_chronon_source(table) + base_url = getattr(source, "online_endpoint", "") or config.online_store.path + object_name = getattr(source, "chronon_join", "") or getattr( + source, "chronon_group_by", "" + ) + if not object_name: + raise ValueError( + f"ChrononSource for feature view '{table.name}' must define either " + "`chronon_join` or `chronon_group_by`." + ) + object_type = "join" if getattr(source, "chronon_join", "") else "groupby" + return ( + f"{base_url.rstrip('/')}/v1/features/" + f"{object_type}/{quote(object_name, safe='')}" + ) + + @staticmethod + def _entity_key_to_request_row(entity_key: EntityKeyProto) -> Dict[str, Any]: + return { + join_key: feast_value_type_to_python_type(value) + for join_key, value in zip(entity_key.join_keys, entity_key.entity_values) + } + + @staticmethod + def _feature_values_to_proto( + response_features: Dict[str, Any], requested_features: Optional[List[str]] + ) -> Dict[str, ValueProto]: + if requested_features is not None: + response_features = { + key: value + for key, value in response_features.items() + if key in requested_features + } + result: Dict[str, ValueProto] = {} + for feature_name, value in response_features.items(): + result[feature_name] = python_values_to_proto_values( + [value], ValueType.UNKNOWN + )[0] + return result + + def online_write_batch( + self, + config: RepoConfig, + table: FeatureView, + data: List[ + Tuple[EntityKeyProto, Dict[str, ValueProto], datetime, Optional[datetime]] + ], + progress: Optional[Callable[[int], Any]], + ) -> None: + raise NotImplementedError( + "ChrononOnlineStore does not support Feast-managed online writes. " + "Chronon-backed features must be populated by Chronon." + ) + + def online_read( + self, + config: RepoConfig, + table: FeatureView, + entity_keys: List[EntityKeyProto], + requested_features: Optional[List[str]] = None, + ) -> List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]]: + assert isinstance(config.online_store, ChrononOnlineStoreConfig) + + url = self._build_url(config, table) + payload = [ + self._entity_key_to_request_row(entity_key) for entity_key in entity_keys + ] + session = HttpSessionManager.get_session( + config.auth_config, + max_retries=0, + ) + response = session.post( + url, + json=payload, + timeout=config.online_store.timeout, + verify=config.online_store.verify_ssl, + ) + response.raise_for_status() + + parsed = response.json() + if not isinstance(parsed, dict): + raise RuntimeError("Chronon response must be a JSON object.") + results = parsed.get("results", []) + if not isinstance(results, list): + raise RuntimeError("Chronon response expected `results` to be a list.") + if len(results) != len(entity_keys): + raise RuntimeError( + f"Chronon returned {len(results)} rows for {len(entity_keys)} entity keys." + ) + + output: List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]] = [] + for row in results: + if not isinstance(row, dict): + raise RuntimeError("Chronon response rows must be JSON objects.") + if row.get("status") != "Success": + output.append((None, None)) + continue + features = row.get("features", {}) + if not isinstance(features, dict): + raise RuntimeError( + "Chronon response row expected `features` to be a JSON object." + ) + feature_values = self._feature_values_to_proto(features, requested_features) + output.append((None, feature_values)) + return output + + def update( + self, + config: RepoConfig, + tables_to_delete, + tables_to_keep, + entities_to_delete, + entities_to_keep, + partial: bool, + ): + return None + + def teardown( + self, + config: RepoConfig, + tables, + entities, + ): + return None diff --git a/sdk/python/feast/infra/provider.py b/sdk/python/feast/infra/provider.py index cc0e60f43b4..e154b6dc05d 100644 --- a/sdk/python/feast/infra/provider.py +++ b/sdk/python/feast/infra/provider.py @@ -43,6 +43,7 @@ "aws": "feast.infra.passthrough_provider.PassthroughProvider", "local": "feast.infra.passthrough_provider.PassthroughProvider", "azure": "feast.infra.passthrough_provider.PassthroughProvider", + "chronon": "feast.infra.chronon_provider.ChrononProvider", } diff --git a/sdk/python/feast/repo_config.py b/sdk/python/feast/repo_config.py index 06529cea0f2..e4574880024 100644 --- a/sdk/python/feast/repo_config.py +++ b/sdk/python/feast/repo_config.py @@ -85,6 +85,7 @@ "milvus": "feast.infra.online_stores.milvus_online_store.milvus.MilvusOnlineStore", "mongodb": "feast.infra.online_stores.mongodb_online_store.MongoDBOnlineStore", "hybrid": "feast.infra.online_stores.hybrid_online_store.hybrid_online_store.HybridOnlineStore", + "chronon": "feast.infra.online_stores.chronon_online_store.chronon.ChrononOnlineStore", **LEGACY_ONLINE_STORE_CLASS_FOR_TYPE, } @@ -105,6 +106,7 @@ "clickhouse": "feast.infra.offline_stores.contrib.clickhouse_offline_store.clickhouse.ClickhouseOfflineStore", "ray": "feast.infra.offline_stores.contrib.ray_offline_store.ray.RayOfflineStore", "oracle": "feast.infra.offline_stores.contrib.oracle_offline_store.oracle.OracleOfflineStore", + "chronon": "feast.infra.offline_stores.contrib.chronon_offline_store.chronon.ChrononOfflineStore", } FEATURE_SERVER_CONFIG_CLASS_FOR_TYPE = { diff --git a/sdk/python/tests/integration/offline_store/test_chronon_offline_store.py b/sdk/python/tests/integration/offline_store/test_chronon_offline_store.py new file mode 100644 index 00000000000..56a85e2b471 --- /dev/null +++ b/sdk/python/tests/integration/offline_store/test_chronon_offline_store.py @@ -0,0 +1,335 @@ +from pathlib import Path + +import pandas as pd +import pytest + +from feast import Entity, FeatureStore, FeatureView, Field, RepoConfig +from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( + ChrononSource, +) +from feast.repo_config import RegistryConfig +from feast.types import Float32 +from feast.value_type import ValueType + + +@pytest.mark.integration +def test_chronon_offline_store_historical_retrieval(tmp_path: Path): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1, 2], + "event_timestamp": [ + pd.Timestamp("2024-01-01T00:00:00Z"), + pd.Timestamp("2024-01-02T00:00:00Z"), + ], + "feature_a": [2.0, 4.0], + } + ).to_parquet(data_path) + + config = RepoConfig( + project="test", + registry=RegistryConfig(path=str(tmp_path / "registry.db")), + provider="chronon", + offline_store={"type": "chronon"}, + online_store={"type": "sqlite", "path": str(tmp_path / "online.db")}, + ) + config.repo_path = tmp_path + + store = FeatureStore(config=config) + user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64) + fv = FeatureView( + name="fraud_profile", + entities=[user], + schema=[Field(name="feature_a", dtype=Float32)], + source=ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ), + offline=True, + ) + store.apply([user, fv]) + + entity_df = pd.DataFrame( + { + "user_id": [1, 2], + "event_timestamp": [ + pd.Timestamp("2024-01-01T00:00:00Z"), + pd.Timestamp("2024-01-02T00:00:00Z"), + ], + } + ) + + result = store.get_historical_features( + entity_df=entity_df, + features=["fraud_profile:feature_a"], + ).to_df() + + assert result["feature_a"].tolist() == [2.0, 4.0] + + +@pytest.mark.integration +def test_chronon_offline_store_uses_latest_record_at_or_before_entity_timestamp( + tmp_path: Path, +): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1, 1, 2], + "event_timestamp": [ + pd.Timestamp("2024-01-01T00:00:00Z"), + pd.Timestamp("2024-01-02T00:00:00Z"), + pd.Timestamp("2024-01-05T00:00:00Z"), + ], + "feature_a": [2.0, 3.0, 8.0], + } + ).to_parquet(data_path) + + config = RepoConfig( + project="test", + registry=RegistryConfig(path=str(tmp_path / "registry.db")), + provider="chronon", + offline_store={"type": "chronon"}, + online_store={"type": "sqlite", "path": str(tmp_path / "online.db")}, + ) + config.repo_path = tmp_path + + store = FeatureStore(config=config) + user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64) + fv = FeatureView( + name="fraud_profile", + entities=[user], + schema=[Field(name="feature_a", dtype=Float32)], + source=ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ), + offline=True, + ) + store.apply([user, fv]) + + entity_df = pd.DataFrame( + { + "user_id": [1, 1, 2], + "event_timestamp": [ + pd.Timestamp("2024-01-01T12:00:00Z"), + pd.Timestamp("2024-01-03T00:00:00Z"), + pd.Timestamp("2024-01-04T00:00:00Z"), + ], + } + ) + + result = store.get_historical_features( + entity_df=entity_df, + features=["fraud_profile:feature_a"], + ).to_df() + + assert result["feature_a"].tolist()[:2] == [2.0, 3.0] + assert pd.isna(result["feature_a"].tolist()[2]) + + +@pytest.mark.integration +def test_chronon_offline_store_uses_latest_created_timestamp(tmp_path: Path): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1, 1], + "event_timestamp": [ + pd.Timestamp("2024-01-01T00:00:00Z"), + pd.Timestamp("2024-01-01T00:00:00Z"), + ], + "created_timestamp": [ + pd.Timestamp("2024-01-01T00:01:00Z"), + pd.Timestamp("2024-01-01T00:02:00Z"), + ], + "feature_a": [2.0, 3.0], + } + ).to_parquet(data_path) + + config = RepoConfig( + project="test", + registry=RegistryConfig(path=str(tmp_path / "registry.db")), + provider="chronon", + offline_store={"type": "chronon"}, + online_store={"type": "sqlite", "path": str(tmp_path / "online.db")}, + ) + config.repo_path = tmp_path + + store = FeatureStore(config=config) + user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64) + fv = FeatureView( + name="fraud_profile", + entities=[user], + schema=[Field(name="feature_a", dtype=Float32)], + source=ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + created_timestamp_column="created_timestamp", + ), + offline=True, + ) + store.apply([user, fv]) + + result = store.get_historical_features( + entity_df=pd.DataFrame( + { + "user_id": [1], + "event_timestamp": [pd.Timestamp("2024-01-01T12:00:00Z")], + } + ), + features=["fraud_profile:feature_a"], + ).to_df() + + assert result["feature_a"].tolist() == [3.0] + + +@pytest.mark.integration +def test_chronon_offline_store_applies_field_mapping_and_full_feature_names( + tmp_path: Path, +): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1], + "event_timestamp": [pd.Timestamp("2024-01-01T00:00:00Z")], + "chronon_feature_a": [2.0], + } + ).to_parquet(data_path) + + config = RepoConfig( + project="test", + registry=RegistryConfig(path=str(tmp_path / "registry.db")), + provider="chronon", + offline_store={"type": "chronon"}, + online_store={"type": "sqlite", "path": str(tmp_path / "online.db")}, + ) + config.repo_path = tmp_path + + store = FeatureStore(config=config) + user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64) + fv = FeatureView( + name="fraud_profile", + entities=[user], + schema=[Field(name="feature_a", dtype=Float32)], + source=ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + field_mapping={"chronon_feature_a": "feature_a"}, + ), + offline=True, + ) + store.apply([user, fv]) + + result = store.get_historical_features( + entity_df=pd.DataFrame( + { + "user_id": [1], + "event_timestamp": [pd.Timestamp("2024-01-01T12:00:00Z")], + } + ), + features=["fraud_profile:feature_a"], + full_feature_names=True, + ).to_df() + + assert result["fraud_profile__feature_a"].tolist() == [2.0] + + +@pytest.mark.integration +def test_chronon_offline_store_returns_empty_feature_columns_for_empty_entity_df( + tmp_path: Path, +): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1], + "event_timestamp": [pd.Timestamp("2024-01-01T00:00:00Z")], + "feature_a": [2.0], + } + ).to_parquet(data_path) + + config = RepoConfig( + project="test", + registry=RegistryConfig(path=str(tmp_path / "registry.db")), + provider="chronon", + offline_store={"type": "chronon"}, + online_store={"type": "sqlite", "path": str(tmp_path / "online.db")}, + ) + config.repo_path = tmp_path + + store = FeatureStore(config=config) + user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64) + fv = FeatureView( + name="fraud_profile", + entities=[user], + schema=[Field(name="feature_a", dtype=Float32)], + source=ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ), + offline=True, + ) + store.apply([user, fv]) + + result = store.get_historical_features( + entity_df=pd.DataFrame( + { + "user_id": pd.Series(dtype="int64"), + "event_timestamp": pd.Series(dtype="datetime64[ns, UTC]"), + } + ), + features=["fraud_profile:feature_a"], + ).to_df() + + assert result.empty + assert "feature_a" in result.columns + + +@pytest.mark.integration +def test_chronon_offline_store_non_entity_retrieval(tmp_path: Path): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1, 2], + "event_timestamp": [ + pd.Timestamp("2024-01-01T00:00:00Z"), + pd.Timestamp("2024-01-02T00:00:00Z"), + ], + "feature_a": [2.0, 4.0], + } + ).to_parquet(data_path) + + config = RepoConfig( + project="test", + registry=RegistryConfig(path=str(tmp_path / "registry.db")), + provider="chronon", + offline_store={"type": "chronon"}, + online_store={"type": "sqlite", "path": str(tmp_path / "online.db")}, + ) + config.repo_path = tmp_path + + store = FeatureStore(config=config) + user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64) + fv = FeatureView( + name="fraud_profile", + entities=[user], + schema=[Field(name="feature_a", dtype=Float32)], + source=ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ), + offline=True, + ) + store.apply([user, fv]) + + result = store.get_historical_features( + features=["fraud_profile:feature_a"], + start_date=pd.Timestamp("2024-01-01T00:00:00Z").to_pydatetime(), + end_date=pd.Timestamp("2024-01-01T23:59:59Z").to_pydatetime(), + ).to_df() + + assert result["feature_a"].tolist() == [2.0] diff --git a/sdk/python/tests/integration/online_store/test_chronon_online_store.py b/sdk/python/tests/integration/online_store/test_chronon_online_store.py new file mode 100644 index 00000000000..831a1c48e4a --- /dev/null +++ b/sdk/python/tests/integration/online_store/test_chronon_online_store.py @@ -0,0 +1,100 @@ +import json +import threading +from http.server import BaseHTTPRequestHandler, HTTPServer +from pathlib import Path + +import pandas as pd +import pytest + +from feast import Entity, FeatureStore, FeatureView, Field, RepoConfig +from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( + ChrononSource, +) +from feast.repo_config import RegistryConfig +from feast.types import Float32 +from feast.value_type import ValueType +from tests.utils.http_server import free_port + + +class _ChrononHandler(BaseHTTPRequestHandler): + def do_POST(self): + body = self.rfile.read(int(self.headers["Content-Length"])) + rows = json.loads(body.decode("utf8")) + response = { + "results": [ + { + "status": "Success", + "entityKeys": row, + "features": {"feature_a": float(row["user_id"]) * 2.0}, + } + for row in rows + ] + } + payload = json.dumps(response).encode("utf8") + self.send_response(200) + self.send_header("Content-Type", "application/json") + self.send_header("Content-Length", str(len(payload))) + self.end_headers() + self.wfile.write(payload) + + def log_message(self, format, *args): + return + + +@pytest.fixture +def chronon_server(): + port = free_port() + server = HTTPServer(("127.0.0.1", port), _ChrononHandler) + thread = threading.Thread(target=server.serve_forever, daemon=True) + thread.start() + yield f"http://127.0.0.1:{port}" + server.shutdown() + thread.join(timeout=5) + + +@pytest.mark.integration +def test_chronon_online_store_feature_store_integration( + tmp_path: Path, chronon_server: str +): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1, 2], + "event_timestamp": [ + pd.Timestamp("2024-01-01T00:00:00Z"), + pd.Timestamp("2024-01-02T00:00:00Z"), + ], + "feature_a": [2.0, 4.0], + } + ).to_parquet(data_path) + + config = RepoConfig( + project="test", + registry=RegistryConfig(path=str(tmp_path / "registry.db")), + provider="chronon", + offline_store={"type": "chronon"}, + online_store={"type": "chronon", "path": chronon_server}, + ) + config.repo_path = tmp_path + + store = FeatureStore(config=config) + user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64) + fv = FeatureView( + name="fraud_profile", + entities=[user], + schema=[Field(name="feature_a", dtype=Float32)], + source=ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ), + online=True, + ) + store.apply([user, fv]) + + response = store.get_online_features( + features=["fraud_profile:feature_a"], + entity_rows=[{"user_id": 1}, {"user_id": 2}], + ).to_dict() + + assert response["feature_a"] == [2.0, 4.0] diff --git a/sdk/python/tests/integration/online_store/test_chronon_online_store_real_service.py b/sdk/python/tests/integration/online_store/test_chronon_online_store_real_service.py new file mode 100644 index 00000000000..3256934b99a --- /dev/null +++ b/sdk/python/tests/integration/online_store/test_chronon_online_store_real_service.py @@ -0,0 +1,67 @@ +import os +from pathlib import Path + +import pandas as pd +import pytest + +from feast import Entity, FeatureStore, FeatureView, Field, RepoConfig +from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( + ChrononSource, +) +from feast.repo_config import RegistryConfig +from feast.types import Int64 +from feast.value_type import ValueType + + +@pytest.mark.integration +def test_chronon_online_store_real_service(tmp_path: Path): + service_url = os.environ.get("CHRONON_SERVICE_URL") + if not service_url: + pytest.skip("Set CHRONON_SERVICE_URL to run against a live Chronon service.") + + data_path = tmp_path / "placeholder.parquet" + pd.DataFrame( + { + "event_timestamp": [pd.Timestamp("2024-01-01T00:00:00Z")], + } + ).to_parquet(data_path) + + config = RepoConfig( + project="test", + registry=RegistryConfig(path=str(tmp_path / "registry.db")), + provider="chronon", + offline_store={"type": "chronon"}, + online_store={"type": "chronon", "path": service_url}, + ) + config.repo_path = tmp_path + + store = FeatureStore(config=config) + user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.STRING) + fv = FeatureView( + name="training_set", + entities=[user], + schema=[ + Field(name="quickstart_purchases_v1_purchase_price_sum_30d", dtype=Int64), + Field(name="quickstart_returns_v1_refund_amt_sum_30d", dtype=Int64), + ], + source=ChrononSource( + materialization_path=str(data_path), + chronon_join="quickstart/training_set.v2", + timestamp_field="event_timestamp", + online_endpoint=service_url, + ), + online=True, + offline=False, + ) + store.apply([user, fv]) + + response = store.get_online_features( + features=[ + "training_set:quickstart_purchases_v1_purchase_price_sum_30d", + "training_set:quickstart_returns_v1_refund_amt_sum_30d", + ], + entity_rows=[{"user_id": "5"}], + ).to_dict() + + assert response["quickstart_purchases_v1_purchase_price_sum_30d"] == [1253] + assert response["quickstart_returns_v1_refund_amt_sum_30d"] == [1269] diff --git a/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_source.py b/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_source.py new file mode 100644 index 00000000000..8ea8434ea8a --- /dev/null +++ b/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_source.py @@ -0,0 +1,105 @@ +from pathlib import Path + +import pandas as pd +import pytest + +from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( + ChrononSource, +) + + +def test_chronon_source_proto_round_trip(tmp_path: Path): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1], + "event_timestamp": [pd.Timestamp("2024-01-01T00:00:00Z")], + "feature_a": [0.5], + } + ).to_parquet(data_path) + + source = ChrononSource( + name="chronon_source", + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + online_endpoint="http://localhost:8080", + timestamp_field="event_timestamp", + ) + + restored = ChrononSource.from_proto(source.to_proto()) + + assert restored.name == source.name + assert restored.materialization_path == source.materialization_path + assert restored.chronon_join == source.chronon_join + assert restored.online_endpoint == source.online_endpoint + assert restored.timestamp_field == source.timestamp_field + + +def test_chronon_source_rejects_join_and_group_by(tmp_path: Path): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1], + "event_timestamp": [pd.Timestamp("2024-01-01T00:00:00Z")], + "feature_a": [0.5], + } + ).to_parquet(data_path) + + with pytest.raises( + ValueError, + match="exactly one of `chronon_join` or `chronon_group_by`", + ): + ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + chronon_group_by="team/user_features.v1", + timestamp_field="event_timestamp", + ) + + +def test_chronon_source_requires_chronon_object_for_online_endpoint(tmp_path: Path): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1], + "event_timestamp": [pd.Timestamp("2024-01-01T00:00:00Z")], + "feature_a": [0.5], + } + ).to_parquet(data_path) + + with pytest.raises( + ValueError, + match="`online_endpoint` requires `chronon_join` or `chronon_group_by`", + ): + ChrononSource( + materialization_path=str(data_path), + online_endpoint="http://localhost:8080", + timestamp_field="event_timestamp", + ) + + +def test_chronon_source_requires_timestamp_field(tmp_path: Path): + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1], + "event_timestamp": [pd.Timestamp("2024-01-01T00:00:00Z")], + "feature_a": [0.5], + } + ).to_parquet(data_path) + + with pytest.raises(ValueError, match="requires `timestamp_field`"): + ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + ) + + +def test_chronon_source_requires_materialization_path(): + with pytest.raises(ValueError, match="requires `materialization_path`"): + ChrononSource( + name="chronon_source", + materialization_path="", + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ) diff --git a/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py b/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py new file mode 100644 index 00000000000..2501a2d3d60 --- /dev/null +++ b/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py @@ -0,0 +1,290 @@ +from pathlib import Path + +import pandas as pd +import pytest + +from feast import Entity, FeatureView, Field +from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( + ChrononSource, +) +from feast.infra.online_stores.chronon_online_store.chronon import ( + ChrononOnlineStore, + ChrononOnlineStoreConfig, +) +from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto +from feast.protos.feast.types.Value_pb2 import Value as ValueProto +from feast.repo_config import RegistryConfig, RepoConfig +from feast.types import Float32, Int64 +from feast.value_type import ValueType + + +class _Response: + def __init__(self, payload): + self._payload = payload + + def raise_for_status(self): + return None + + def json(self): + return self._payload + + +def _write_chronon_parquet(tmp_path: Path) -> Path: + data_path = tmp_path / "chronon.parquet" + pd.DataFrame( + { + "user_id": [1], + "event_timestamp": [pd.Timestamp("2024-01-01T00:00:00Z")], + "feature_a": [0.5], + } + ).to_parquet(data_path) + return data_path + + +def _repo_config(tmp_path: Path) -> RepoConfig: + config = RepoConfig( + project="test", + registry=RegistryConfig(path=str(tmp_path / "registry.db")), + provider="chronon", + offline_store={"type": "chronon"}, + online_store=ChrononOnlineStoreConfig(path="http://chronon.test"), + ) + config.repo_path = tmp_path + return config + + +def _feature_view(source: ChrononSource) -> FeatureView: + return FeatureView( + name="fraud_profile", + entities=[ + Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64) + ], + schema=[ + Field(name="user_id", dtype=Int64), + Field(name="feature_a", dtype=Float32), + ], + source=source, + ) + + +def _entity_keys() -> list[EntityKeyProto]: + return [ + EntityKeyProto( + join_keys=["user_id"], + entity_values=[ValueProto(int64_val=1)], + ), + EntityKeyProto( + join_keys=["user_id"], + entity_values=[ValueProto(int64_val=2)], + ), + ] + + +def test_chronon_online_store_maps_success_and_failure(monkeypatch, tmp_path: Path): + data_path = _write_chronon_parquet(tmp_path) + config = _repo_config(tmp_path) + + source = ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ) + feature_view = _feature_view(source) + + captured = {} + + class _Session: + def post(self, url, json, timeout, verify): + captured["url"] = url + captured["json"] = json + return _Response( + { + "results": [ + {"status": "Success", "features": {"feature_a": 0.5}}, + {"status": "Failure", "error": "boom"}, + ] + } + ) + + monkeypatch.setattr( + "feast.infra.online_stores.chronon_online_store.chronon.HttpSessionManager.get_session", + lambda config, **kwargs: _Session(), + ) + + store = ChrononOnlineStore() + entity_keys = _entity_keys() + + rows = store.online_read( + config, feature_view, entity_keys, requested_features=["feature_a"] + ) + + assert captured["url"].endswith("/v1/features/join/team%2Ftraining_set.v1") + assert captured["json"] == [{"user_id": 1}, {"user_id": 2}] + assert rows[0][1] is not None + assert abs(rows[0][1]["feature_a"].double_val - 0.5) < 1e-6 + assert rows[1] == (None, None) + + +def test_chronon_online_store_builds_group_by_url(monkeypatch, tmp_path: Path): + data_path = _write_chronon_parquet(tmp_path) + config = _repo_config(tmp_path) + source = ChrononSource( + materialization_path=str(data_path), + chronon_group_by="team/user_features.v1", + timestamp_field="event_timestamp", + ) + feature_view = _feature_view(source) + captured = {} + + class _Session: + def post(self, url, json, timeout, verify): + captured["url"] = url + return _Response( + { + "results": [ + {"status": "Success", "features": {"feature_a": 0.5}}, + {"status": "Success", "features": {"feature_a": 1.0}}, + ] + } + ) + + monkeypatch.setattr( + "feast.infra.online_stores.chronon_online_store.chronon.HttpSessionManager.get_session", + lambda config, **kwargs: _Session(), + ) + + ChrononOnlineStore().online_read( + config, + feature_view, + _entity_keys(), + requested_features=["feature_a"], + ) + + assert captured["url"].endswith("/v1/features/groupby/team%2Fuser_features.v1") + + +def test_chronon_online_store_rejects_mismatched_result_count( + monkeypatch, tmp_path: Path +): + data_path = _write_chronon_parquet(tmp_path) + config = _repo_config(tmp_path) + source = ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ) + feature_view = _feature_view(source) + + class _Session: + def post(self, url, json, timeout, verify): + return _Response( + {"results": [{"status": "Success", "features": {"feature_a": 0.5}}]} + ) + + monkeypatch.setattr( + "feast.infra.online_stores.chronon_online_store.chronon.HttpSessionManager.get_session", + lambda config, **kwargs: _Session(), + ) + + with pytest.raises(RuntimeError, match="returned 1 rows for 2 entity keys"): + ChrononOnlineStore().online_read( + config, + feature_view, + _entity_keys(), + requested_features=["feature_a"], + ) + + +def test_chronon_online_store_rejects_invalid_response_shape( + monkeypatch, tmp_path: Path +): + data_path = _write_chronon_parquet(tmp_path) + config = _repo_config(tmp_path) + source = ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ) + feature_view = _feature_view(source) + + class _Session: + def post(self, url, json, timeout, verify): + return _Response({"results": {"status": "Success"}}) + + monkeypatch.setattr( + "feast.infra.online_stores.chronon_online_store.chronon.HttpSessionManager.get_session", + lambda config, **kwargs: _Session(), + ) + + with pytest.raises(RuntimeError, match="expected `results` to be a list"): + ChrononOnlineStore().online_read( + config, + feature_view, + _entity_keys(), + requested_features=["feature_a"], + ) + + +def test_chronon_online_store_rejects_invalid_result_row(monkeypatch, tmp_path: Path): + data_path = _write_chronon_parquet(tmp_path) + config = _repo_config(tmp_path) + source = ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ) + feature_view = _feature_view(source) + + class _Session: + def post(self, url, json, timeout, verify): + return _Response({"results": ["not-a-row", "still-not-a-row"]}) + + monkeypatch.setattr( + "feast.infra.online_stores.chronon_online_store.chronon.HttpSessionManager.get_session", + lambda config, **kwargs: _Session(), + ) + + with pytest.raises(RuntimeError, match="rows must be JSON objects"): + ChrononOnlineStore().online_read( + config, + feature_view, + _entity_keys(), + requested_features=["feature_a"], + ) + + +def test_chronon_online_store_rejects_invalid_features_payload( + monkeypatch, tmp_path: Path +): + data_path = _write_chronon_parquet(tmp_path) + config = _repo_config(tmp_path) + source = ChrononSource( + materialization_path=str(data_path), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ) + feature_view = _feature_view(source) + + class _Session: + def post(self, url, json, timeout, verify): + return _Response( + { + "results": [ + {"status": "Success", "features": ["not", "an", "object"]}, + {"status": "Success", "features": {"feature_a": 1.0}}, + ] + } + ) + + monkeypatch.setattr( + "feast.infra.online_stores.chronon_online_store.chronon.HttpSessionManager.get_session", + lambda config, **kwargs: _Session(), + ) + + with pytest.raises(RuntimeError, match="`features` to be a JSON object"): + ChrononOnlineStore().online_read( + config, + feature_view, + _entity_keys(), + requested_features=["feature_a"], + ) diff --git a/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py b/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py new file mode 100644 index 00000000000..4c59ccb4f8d --- /dev/null +++ b/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py @@ -0,0 +1,40 @@ +import os +import subprocess +from pathlib import Path + + +def _script_path() -> Path: + return ( + Path(__file__).resolve().parents[6] + / "infra" + / "scripts" + / "chronon" + / "start-local-chronon-service.sh" + ) + + +def test_start_script_documents_chronon_repo_override(): + script = _script_path().read_text() + + assert "CHRONON_REPO" in script + assert "CHRONON_PREFLIGHT_ONLY" in script + + +def test_start_script_can_fail_before_docker_when_repo_missing(tmp_path: Path): + missing_repo = tmp_path / "missing-chronon" + result = subprocess.run( + ["bash", str(_script_path())], + env={ + **os.environ, + "CHRONON_PREFLIGHT_ONLY": "1", + "CHRONON_REPO": str(missing_repo), + }, + capture_output=True, + text=True, + check=False, + ) + + assert result.returncode == 1 + assert str(missing_repo) in result.stderr + assert "CHRONON_REPO" in result.stderr + assert "git clone" in result.stderr From 8f5a2e6fe042d54a7b629477660786c59fbd6f97 Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Mon, 22 Jun 2026 08:48:56 -0400 Subject: [PATCH 02/11] docs: add Chronon demo Signed-off-by: Francisco Javier Arceo --- examples/README.md | 1 + examples/chronon/README.md | 60 ++++++ examples/chronon/run_demo.py | 202 ++++++++++++++++++ .../chronon/chronon_service_launcher.py | 55 +++++ .../chronon/start-local-chronon-service.sh | 43 +++- .../chronon/stop-local-chronon-service.sh | 12 +- 6 files changed, 360 insertions(+), 13 deletions(-) create mode 100644 examples/chronon/README.md create mode 100644 examples/chronon/run_demo.py create mode 100755 infra/scripts/chronon/chronon_service_launcher.py diff --git a/examples/README.md b/examples/README.md index 3585ee33682..256183c5e72 100644 --- a/examples/README.md +++ b/examples/README.md @@ -13,6 +13,7 @@ The following examples illustrate various **Feast** use cases to enhance underst 1. **[Podman/Podman Compose Local](podman_local)**: Demonstrates how to deploy Feast remote server components using Podman Compose locally. 1. **[RHOAI Feast Demo](rhoai-quickstart)**: Showcases Feast's core functionality using a Jupyter notebook, including fetching online feature data from a remote server and retrieving metadata from a remote registry. 1. **[RAG Fine Tuning with Feast and Milvus](rag-retriever)**: Demonstrates end-to-end RAG fine-tuning using Feast and Milvus, including data preparation, embedding generation, feature store setup, and RAG system implementation with custom FeastRagRetriever. +1. **[Chronon Demo](chronon)**: Demonstrates historical retrieval from Chronon materializations and online retrieval from a live Chronon quickstart service. # Feast Operator Examples diff --git a/examples/chronon/README.md b/examples/chronon/README.md new file mode 100644 index 00000000000..6371d8690e7 --- /dev/null +++ b/examples/chronon/README.md @@ -0,0 +1,60 @@ +# Chronon Demo + +This example shows Feast reading Chronon-backed features in two modes: + +- Offline historical retrieval from a Chronon materialization exported as Parquet. +- Online retrieval from a live Chronon quickstart service. + +## Offline Only + +```bash +uv run python examples/chronon/run_demo.py --offline-only +``` + +## Live Chronon Service + +Install `sbt` and a JDK. On macOS with Homebrew, this is enough: + +```bash +brew install sbt openjdk@11 +export JAVA_HOME=/opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk/Contents/Home +``` + +Build Chronon at the commit used by Feast's Chronon integration workflow: + +```bash +git clone https://github.com/airbnb/chronon.git /tmp/chronon +git -C /tmp/chronon checkout 6c0b8de9f0301521baf61a46ff3083c566fb4052 # pragma: allowlist secret + +cd /tmp/chronon/quickstart/mongo-online-impl +sbt assembly + +cd /tmp/chronon +sbt "project service" assembly +``` + +Start the local quickstart stack and Chronon service: + +```bash +CHRONON_REPO=/tmp/chronon \ +JAVA_BIN="${JAVA_HOME}/bin/java" \ +infra/scripts/chronon/start-local-chronon-service.sh +``` + +If port `9000` is already in use, choose another port and pass the same URL to the demo: + +```bash +CHRONON_REPO=/tmp/chronon \ +CHRONON_SERVICE_PORT=19000 \ +JAVA_BIN="${JAVA_HOME}/bin/java" \ +infra/scripts/chronon/start-local-chronon-service.sh + +CHRONON_SERVICE_URL=http://127.0.0.1:19000 \ +uv run python examples/chronon/run_demo.py +``` + +Stop the local stack when done: + +```bash +infra/scripts/chronon/stop-local-chronon-service.sh +``` diff --git a/examples/chronon/run_demo.py b/examples/chronon/run_demo.py new file mode 100644 index 00000000000..c101b937594 --- /dev/null +++ b/examples/chronon/run_demo.py @@ -0,0 +1,202 @@ +import argparse +import json +import os +import tempfile +from pathlib import Path +from urllib.request import urlopen + +import pandas as pd + +from feast import Entity, FeatureStore, FeatureView, Field, RepoConfig +from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( + ChrononSource, +) +from feast.repo_config import RegistryConfig +from feast.types import Float32, Int64 +from feast.value_type import ValueType + +QUICKSTART_JOIN = "quickstart/training_set.v2" +PURCHASE_SUM_30D = "quickstart_purchases_v1_purchase_price_sum_30d" +REFUND_SUM_30D = "quickstart_returns_v1_refund_amt_sum_30d" + + +def _repo_config( + repo_path: Path, + project: str, + offline_store: dict[str, str], + online_store: dict[str, str], +) -> RepoConfig: + config = RepoConfig( + project=project, + registry=RegistryConfig(path=str(repo_path / "registry.db")), + provider="chronon", + offline_store=offline_store, + online_store=online_store, + ) + config.repo_path = repo_path + return config + + +def run_offline_demo() -> pd.DataFrame: + with tempfile.TemporaryDirectory(prefix="feast-chronon-offline-") as tmp: + repo_path = Path(tmp) + materialization_path = repo_path / "driver_stats.parquet" + pd.DataFrame( + { + "driver_id": [1001, 1001, 1002], + "event_timestamp": [ + pd.Timestamp("2024-01-01T00:00:00Z"), + pd.Timestamp("2024-01-03T00:00:00Z"), + pd.Timestamp("2024-01-02T00:00:00Z"), + ], + "completed_rides_7d": [12, 18, 7], + "average_rating": [4.6, 4.8, 4.2], + } + ).to_parquet(materialization_path) + + store = FeatureStore( + config=_repo_config( + repo_path=repo_path, + project="chronon_demo_offline", + offline_store={"type": "chronon"}, + online_store={"type": "sqlite", "path": str(repo_path / "online.db")}, + ) + ) + driver = Entity( + name="driver", + join_keys=["driver_id"], + value_type=ValueType.INT64, + ) + driver_stats = FeatureView( + name="driver_stats", + entities=[driver], + schema=[ + Field(name="completed_rides_7d", dtype=Int64), + Field(name="average_rating", dtype=Float32), + ], + source=ChrononSource( + materialization_path=str(materialization_path), + chronon_join="demo/driver_stats.v1", + timestamp_field="event_timestamp", + ), + offline=True, + ) + store.apply([driver, driver_stats]) + + entity_df = pd.DataFrame( + { + "driver_id": [1001, 1002], + "event_timestamp": [ + pd.Timestamp("2024-01-04T00:00:00Z"), + pd.Timestamp("2024-01-02T12:00:00Z"), + ], + } + ) + result = store.get_historical_features( + entity_df=entity_df, + features=[ + "driver_stats:completed_rides_7d", + "driver_stats:average_rating", + ], + ).to_df() + + assert result["completed_rides_7d"].tolist() == [18, 7] + assert result["average_rating"].round(1).tolist() == [4.8, 4.2] + return result + + +def _assert_service_available(service_url: str) -> None: + ping_url = f"{service_url.rstrip('/')}/ping" + try: + with urlopen(ping_url, timeout=5) as response: + response.read() + except OSError as exc: + raise RuntimeError( + f"Chronon service is not reachable at {ping_url}. Start it with " + "`infra/scripts/chronon/start-local-chronon-service.sh` or pass " + "`--offline-only`." + ) from exc + + +def run_online_demo(service_url: str) -> dict[str, list[object]]: + _assert_service_available(service_url) + with tempfile.TemporaryDirectory(prefix="feast-chronon-online-") as tmp: + repo_path = Path(tmp) + placeholder_path = repo_path / "placeholder.parquet" + pd.DataFrame( + { + "event_timestamp": [pd.Timestamp("2024-01-01T00:00:00Z")], + } + ).to_parquet(placeholder_path) + + store = FeatureStore( + config=_repo_config( + repo_path=repo_path, + project="chronon_demo_online", + offline_store={"type": "chronon"}, + online_store={"type": "chronon", "path": service_url}, + ) + ) + user = Entity( + name="user", + join_keys=["user_id"], + value_type=ValueType.STRING, + ) + training_set = FeatureView( + name="training_set", + entities=[user], + schema=[ + Field(name=PURCHASE_SUM_30D, dtype=Int64), + Field(name=REFUND_SUM_30D, dtype=Int64), + ], + source=ChrononSource( + materialization_path=str(placeholder_path), + chronon_join=QUICKSTART_JOIN, + timestamp_field="event_timestamp", + online_endpoint=service_url, + ), + online=True, + offline=False, + ) + store.apply([user, training_set]) + + response = store.get_online_features( + features=[ + f"training_set:{PURCHASE_SUM_30D}", + f"training_set:{REFUND_SUM_30D}", + ], + entity_rows=[{"user_id": "5"}], + ).to_dict() + + assert response[PURCHASE_SUM_30D] == [1253] + assert response[REFUND_SUM_30D] == [1269] + return response + + +def main() -> int: + parser = argparse.ArgumentParser(description="Run the Feast Chronon demo.") + mode = parser.add_mutually_exclusive_group() + mode.add_argument("--offline-only", action="store_true") + mode.add_argument("--online-only", action="store_true") + parser.add_argument( + "--service-url", + default=os.environ.get("CHRONON_SERVICE_URL", "http://127.0.0.1:9000"), + help="Chronon service URL for the online demo.", + ) + args = parser.parse_args() + + if not args.online_only: + offline_result = run_offline_demo() + print("Offline historical features:") + print(offline_result.to_string(index=False)) + + if not args.offline_only: + online_result = run_online_demo(args.service_url) + print("\nOnline quickstart features:") + print(json.dumps(online_result, indent=2, sort_keys=True)) + + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/infra/scripts/chronon/chronon_service_launcher.py b/infra/scripts/chronon/chronon_service_launcher.py new file mode 100755 index 00000000000..a6f502e36c4 --- /dev/null +++ b/infra/scripts/chronon/chronon_service_launcher.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""Launch the Chronon service detached from the calling shell.""" + +from __future__ import annotations + +import argparse +import subprocess +from pathlib import Path + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser() + parser.add_argument("--chronon-dir", required=True) + parser.add_argument("--java-bin", required=True) + parser.add_argument("--service-jar", required=True) + parser.add_argument("--service-port", required=True) + parser.add_argument("--log-file", required=True) + parser.add_argument("--pid-file", required=True) + return parser.parse_args() + + +def main() -> int: + args = parse_args() + chronon_dir = Path(args.chronon_dir) + log_path = Path(args.log_file) + pid_path = Path(args.pid_file) + log_path.parent.mkdir(parents=True, exist_ok=True) + pid_path.parent.mkdir(parents=True, exist_ok=True) + command = [ + args.java_bin, + "-jar", + args.service_jar, + "run", + "ai.chronon.service.WebServiceVerticle", + f"-Dserver.port={args.service_port}", + "-conf", + "service/src/main/resources/example_config.json", + ] + + with Path("/dev/null").open("rb") as devnull, log_path.open("wb") as log_file: + process = subprocess.Popen( + command, + cwd=chronon_dir, + stdin=devnull, + stdout=log_file, + stderr=subprocess.STDOUT, + start_new_session=True, + ) + + pid_path.write_text(f"{process.pid}\n") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/infra/scripts/chronon/start-local-chronon-service.sh b/infra/scripts/chronon/start-local-chronon-service.sh index f0b5184cc66..161c64d8e6f 100755 --- a/infra/scripts/chronon/start-local-chronon-service.sh +++ b/infra/scripts/chronon/start-local-chronon-service.sh @@ -13,9 +13,25 @@ SERVICE_HOST="${CHRONON_SERVICE_HOST:-127.0.0.1}" SERVICE_PID_FILE="${CHRONON_SERVICE_PID_FILE:-/tmp/chronon-service.pid}" SERVICE_LOG_FILE="${CHRONON_SERVICE_LOG_FILE:-/tmp/chronon-service.log}" JAVA_BIN="${JAVA_BIN:-java}" +PYTHON_BIN="${PYTHON_BIN:-python3}" CHRONON_PREFLIGHT_ONLY="${CHRONON_PREFLIGHT_ONLY:-0}" MONGO_IMPL_JAR="${CHRONON_DIR}/quickstart/mongo-online-impl/target/scala-2.12/mongo-online-impl-assembly-0.1.0-SNAPSHOT.jar" -SERVICE_JAR="${CHRONON_DIR}/service/target/scala-2.12/service-0.0.111-SNAPSHOT.jar" +SERVICE_JAR="${CHRONON_SERVICE_JAR:-}" + +find_service_jar() { + if [[ -n "${SERVICE_JAR}" ]]; then + echo "${SERVICE_JAR}" + return + fi + + find "${CHRONON_DIR}/service/target/scala-2.12" \ + -maxdepth 1 \ + -type f \ + -name "service-*.jar" \ + ! -name "*-sources.jar" \ + ! -name "*-javadoc.jar" \ + 2>/dev/null | sort | tail -n 1 +} print_setup_help() { cat >&2 <&2 print_setup_help @@ -92,9 +110,15 @@ wait_for_http() { local url="$1" local attempts=60 until curl --fail --silent "${url}" >/dev/null; do + if [[ -f "${SERVICE_PID_FILE}" ]] && ! kill -0 "$(cat "${SERVICE_PID_FILE}")" >/dev/null 2>&1; then + echo "Chronon service exited before becoming ready. Log: ${SERVICE_LOG_FILE}" >&2 + tail -100 "${SERVICE_LOG_FILE}" >&2 || true + exit 1 + fi attempts=$((attempts - 1)) if [[ "${attempts}" -le 0 ]]; then echo "Chronon service did not become ready at ${url}." >&2 + tail -100 "${SERVICE_LOG_FILE}" >&2 || true exit 1 fi sleep 2 @@ -152,16 +176,13 @@ docker run -d \ wait_for_data_load run_quickstart_online_prep -: > "${SERVICE_LOG_FILE}" -( - cd "${CHRONON_DIR}" - exec "${JAVA_BIN}" -jar service/target/scala-2.12/service-0.0.111-SNAPSHOT.jar \ - run ai.chronon.service.WebServiceVerticle \ - -Dserver.port="${SERVICE_PORT}" \ - -conf service/src/main/resources/example_config.json -) >"${SERVICE_LOG_FILE}" 2>&1 & - -echo "$!" > "${SERVICE_PID_FILE}" +"${PYTHON_BIN}" "${ROOT_DIR}/infra/scripts/chronon/chronon_service_launcher.py" \ + --chronon-dir "${CHRONON_DIR}" \ + --java-bin "${JAVA_BIN}" \ + --service-jar "${SERVICE_JAR}" \ + --service-port "${SERVICE_PORT}" \ + --log-file "${SERVICE_LOG_FILE}" \ + --pid-file "${SERVICE_PID_FILE}" wait_for_http "http://${SERVICE_HOST}:${SERVICE_PORT}/ping" echo "CHRONON_SERVICE_URL=http://${SERVICE_HOST}:${SERVICE_PORT}" diff --git a/infra/scripts/chronon/stop-local-chronon-service.sh b/infra/scripts/chronon/stop-local-chronon-service.sh index 4aceed23659..f1efcd137c3 100755 --- a/infra/scripts/chronon/stop-local-chronon-service.sh +++ b/infra/scripts/chronon/stop-local-chronon-service.sh @@ -10,8 +10,16 @@ SERVICE_PID_FILE="${CHRONON_SERVICE_PID_FILE:-/tmp/chronon-service.pid}" if [[ -f "${SERVICE_PID_FILE}" ]]; then pid="$(cat "${SERVICE_PID_FILE}")" if kill -0 "${pid}" >/dev/null 2>&1; then - kill "${pid}" >/dev/null 2>&1 || true - wait "${pid}" 2>/dev/null || true + kill "-${pid}" >/dev/null 2>&1 || kill "${pid}" >/dev/null 2>&1 || true + for _ in {1..20}; do + if ! kill -0 "${pid}" >/dev/null 2>&1; then + break + fi + sleep 0.5 + done + if kill -0 "${pid}" >/dev/null 2>&1; then + kill -9 "-${pid}" >/dev/null 2>&1 || kill -9 "${pid}" >/dev/null 2>&1 || true + fi fi rm -f "${SERVICE_PID_FILE}" fi From 5adfb98e7618d87d6e80197146a7511afe7d591d Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Mon, 22 Jun 2026 09:05:48 -0400 Subject: [PATCH 03/11] fix: preserve Chronon setup error output Signed-off-by: Francisco Javier Arceo --- .../chronon/start-local-chronon-service.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/infra/scripts/chronon/start-local-chronon-service.sh b/infra/scripts/chronon/start-local-chronon-service.sh index 161c64d8e6f..5aed0d0ffc1 100755 --- a/infra/scripts/chronon/start-local-chronon-service.sh +++ b/infra/scripts/chronon/start-local-chronon-service.sh @@ -16,6 +16,7 @@ JAVA_BIN="${JAVA_BIN:-java}" PYTHON_BIN="${PYTHON_BIN:-python3}" CHRONON_PREFLIGHT_ONLY="${CHRONON_PREFLIGHT_ONLY:-0}" MONGO_IMPL_JAR="${CHRONON_DIR}/quickstart/mongo-online-impl/target/scala-2.12/mongo-online-impl-assembly-0.1.0-SNAPSHOT.jar" +SERVICE_TARGET_DIR="${CHRONON_DIR}/service/target/scala-2.12" SERVICE_JAR="${CHRONON_SERVICE_JAR:-}" find_service_jar() { @@ -24,7 +25,11 @@ find_service_jar() { return fi - find "${CHRONON_DIR}/service/target/scala-2.12" \ + if [[ ! -d "${SERVICE_TARGET_DIR}" ]]; then + return 0 + fi + + find "${SERVICE_TARGET_DIR}" \ -maxdepth 1 \ -type f \ -name "service-*.jar" \ @@ -45,14 +50,14 @@ Example: EOF } -SERVICE_JAR="$(find_service_jar)" - if [[ ! -d "${CHRONON_DIR}" ]]; then echo "Chronon repo not found at ${CHRONON_DIR}. Set CHRONON_REPO to a local checkout." >&2 print_setup_help exit 1 fi +SERVICE_JAR="$(find_service_jar)" + if [[ ! -f "${MONGO_IMPL_JAR}" ]]; then echo "Missing quickstart Mongo implementation jar at ${MONGO_IMPL_JAR}." >&2 print_setup_help @@ -60,7 +65,11 @@ if [[ ! -f "${MONGO_IMPL_JAR}" ]]; then fi if [[ ! -f "${SERVICE_JAR}" ]]; then - echo "Missing Chronon service jar at ${SERVICE_JAR}." >&2 + if [[ -n "${CHRONON_SERVICE_JAR:-}" ]]; then + echo "Missing Chronon service jar at ${SERVICE_JAR}." >&2 + else + echo "Missing Chronon service jar under ${SERVICE_TARGET_DIR}. Set CHRONON_SERVICE_JAR to override." >&2 + fi print_setup_help exit 1 fi From 03c7b4bb95365def8014a329ca0addbfe43dc850 Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Mon, 22 Jun 2026 13:00:50 -0400 Subject: [PATCH 04/11] docs: expand Chronon checkout risk demo Signed-off-by: Francisco Javier Arceo --- examples/chronon/README.md | 24 ++ examples/chronon/run_demo.py | 231 +++++++++++++++++- .../tests/unit/examples/test_chronon_demo.py | 69 ++++++ 3 files changed, 320 insertions(+), 4 deletions(-) create mode 100644 sdk/python/tests/unit/examples/test_chronon_demo.py diff --git a/examples/chronon/README.md b/examples/chronon/README.md index 6371d8690e7..cf019c0e4d2 100644 --- a/examples/chronon/README.md +++ b/examples/chronon/README.md @@ -53,6 +53,30 @@ CHRONON_SERVICE_URL=http://127.0.0.1:19000 \ uv run python examples/chronon/run_demo.py ``` +## Checkout Risk Scenario + +The richer checkout-risk scenario registers a Feast `FeatureService` over +Chronon's `quickstart/training_set.v2` join, fetches multiple users from the +live Chronon service, and prints a small risk summary from purchase and refund +aggregates: + +```bash +CHRONON_SERVICE_URL=http://127.0.0.1:19000 \ +uv run python examples/chronon/run_demo.py --scenario checkout-risk +``` + +By default it retrieves users `5`, `7`, and `999999`. The first two should +return Chronon quickstart aggregates; `999999` demonstrates how Feast surfaces a +known entity key with missing Chronon features. You can choose different users: + +```bash +CHRONON_SERVICE_URL=http://127.0.0.1:19000 \ +uv run python examples/chronon/run_demo.py \ + --scenario checkout-risk \ + --online-only \ + --user-ids 5,7,999999 +``` + Stop the local stack when done: ```bash diff --git a/examples/chronon/run_demo.py b/examples/chronon/run_demo.py index c101b937594..1c9dbd2e0e0 100644 --- a/examples/chronon/run_demo.py +++ b/examples/chronon/run_demo.py @@ -3,11 +3,13 @@ import os import tempfile from pathlib import Path +from urllib.parse import quote +from urllib.request import Request from urllib.request import urlopen import pandas as pd -from feast import Entity, FeatureStore, FeatureView, Field, RepoConfig +from feast import Entity, FeatureService, FeatureStore, FeatureView, Field, RepoConfig from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( ChrononSource, ) @@ -17,7 +19,30 @@ QUICKSTART_JOIN = "quickstart/training_set.v2" PURCHASE_SUM_30D = "quickstart_purchases_v1_purchase_price_sum_30d" +PURCHASE_SUM_14D = "quickstart_purchases_v1_purchase_price_sum_14d" +PURCHASE_COUNT_30D = "quickstart_purchases_v1_purchase_price_count_30d" +PURCHASE_COUNT_14D = "quickstart_purchases_v1_purchase_price_count_14d" +PURCHASE_AVERAGE_30D = "quickstart_purchases_v1_purchase_price_average_30d" REFUND_SUM_30D = "quickstart_returns_v1_refund_amt_sum_30d" +REFUND_SUM_14D = "quickstart_returns_v1_refund_amt_sum_14d" +REFUND_COUNT_30D = "quickstart_returns_v1_refund_amt_count_30d" +REFUND_COUNT_14D = "quickstart_returns_v1_refund_amt_count_14d" +REFUND_AVERAGE_30D = "quickstart_returns_v1_refund_amt_average_30d" +CHECKOUT_RISK_FEATURE_VIEW = "checkout_risk_features" +CHECKOUT_RISK_FEATURE_SERVICE = "checkout_risk_v1" +CHECKOUT_RISK_DEFAULT_USER_IDS = ["5", "7", "999999"] +CHECKOUT_RISK_FEATURES = [ + PURCHASE_SUM_14D, + PURCHASE_SUM_30D, + PURCHASE_COUNT_14D, + PURCHASE_COUNT_30D, + PURCHASE_AVERAGE_30D, + REFUND_SUM_14D, + REFUND_SUM_30D, + REFUND_COUNT_14D, + REFUND_COUNT_30D, + REFUND_AVERAGE_30D, +] def _repo_config( @@ -173,16 +198,191 @@ def run_online_demo(service_url: str) -> dict[str, list[object]]: return response +def create_checkout_risk_feature_store( + repo_path: Path, service_url: str +) -> tuple[FeatureStore, FeatureService, list[str]]: + repo_path.mkdir(parents=True, exist_ok=True) + placeholder_path = repo_path / "checkout_risk_placeholder.parquet" + pd.DataFrame( + { + "event_timestamp": [pd.Timestamp("2024-01-01T00:00:00Z")], + } + ).to_parquet(placeholder_path) + + store = FeatureStore( + config=_repo_config( + repo_path=repo_path, + project="chronon_checkout_risk", + offline_store={"type": "chronon"}, + online_store={"type": "chronon", "path": service_url}, + ) + ) + user = Entity( + name="user", + join_keys=["user_id"], + value_type=ValueType.STRING, + ) + checkout_risk_features = FeatureView( + name=CHECKOUT_RISK_FEATURE_VIEW, + entities=[user], + schema=[ + Field(name=PURCHASE_SUM_14D, dtype=Int64), + Field(name=PURCHASE_SUM_30D, dtype=Int64), + Field(name=PURCHASE_COUNT_14D, dtype=Int64), + Field(name=PURCHASE_COUNT_30D, dtype=Int64), + Field(name=PURCHASE_AVERAGE_30D, dtype=Float32), + Field(name=REFUND_SUM_14D, dtype=Int64), + Field(name=REFUND_SUM_30D, dtype=Int64), + Field(name=REFUND_COUNT_14D, dtype=Int64), + Field(name=REFUND_COUNT_30D, dtype=Int64), + Field(name=REFUND_AVERAGE_30D, dtype=Float32), + ], + source=ChrononSource( + materialization_path=str(placeholder_path), + chronon_join=QUICKSTART_JOIN, + timestamp_field="event_timestamp", + online_endpoint=service_url, + ), + online=True, + offline=False, + ) + feature_service = FeatureService( + name=CHECKOUT_RISK_FEATURE_SERVICE, + features=[checkout_risk_features], + description="Checkout-time risk features served by Chronon.", + tags={"demo": "chronon", "scenario": "checkout-risk"}, + ) + store.apply([user, checkout_risk_features, feature_service]) + feature_refs = [ + f"{CHECKOUT_RISK_FEATURE_VIEW}:{feature_name}" + for feature_name in CHECKOUT_RISK_FEATURES + ] + return store, feature_service, feature_refs + + +def fetch_direct_chronon_join( + service_url: str, user_ids: list[str] +) -> dict[str, object]: + url = ( + f"{service_url.rstrip('/')}/v1/features/join/{quote(QUICKSTART_JOIN, safe='')}" + ) + request = Request( + url=url, + data=json.dumps([{"user_id": user_id} for user_id in user_ids]).encode("utf-8"), + headers={"Content-Type": "application/json"}, + method="POST", + ) + with urlopen(request, timeout=10) as response: + return json.loads(response.read().decode("utf-8")) + + +def _get_response_value( + response: dict[str, list[object]], feature_name: str, index: int +) -> object: + values = response.get(feature_name, []) + if index >= len(values): + return None + return values[index] + + +def summarize_checkout_risk_response( + response: dict[str, list[object]], +) -> list[dict[str, object]]: + rows: list[dict[str, object]] = [] + for index, user_id in enumerate(response.get("user_id", [])): + purchase_sum = _get_response_value(response, PURCHASE_SUM_30D, index) + purchase_count = _get_response_value(response, PURCHASE_COUNT_30D, index) + refund_sum = _get_response_value(response, REFUND_SUM_30D, index) + refund_count = _get_response_value(response, REFUND_COUNT_30D, index) + + ratio = None + if isinstance(purchase_sum, (int, float)) and isinstance( + refund_sum, (int, float) + ): + ratio = round(refund_sum / purchase_sum, 3) if purchase_sum else None + + rows.append( + { + "user_id": user_id, + "purchase_sum_30d": purchase_sum, + "purchase_count_30d": purchase_count, + "refund_sum_30d": refund_sum, + "refund_count_30d": refund_count, + "refund_to_purchase_ratio_30d": ratio, + "status": ( + "features_found" + if any( + value is not None + for value in [ + purchase_sum, + purchase_count, + refund_sum, + refund_count, + ] + ) + else "missing_features" + ), + } + ) + return rows + + +def run_checkout_risk_demo(service_url: str, user_ids: list[str]) -> dict[str, object]: + _assert_service_available(service_url) + with tempfile.TemporaryDirectory(prefix="feast-chronon-checkout-risk-") as tmp: + repo_path = Path(tmp) + store, feature_service, feature_refs = create_checkout_risk_feature_store( + repo_path, service_url + ) + entity_rows = [{"user_id": user_id} for user_id in user_ids] + direct_response = fetch_direct_chronon_join(service_url, user_ids) + feast_response = store.get_online_features( + features=feature_service, + entity_rows=entity_rows, + ).to_dict() + + return { + "registry_objects": { + "entities": [entity.name for entity in store.list_entities()], + "feature_views": [ + feature_view.name for feature_view in store.list_feature_views() + ], + "feature_services": [ + service.name for service in store.list_feature_services() + ], + }, + "feature_refs": feature_refs, + "direct_chronon": direct_response, + "feast_online": feast_response, + "checkout_risk_summary": summarize_checkout_risk_response(feast_response), + } + + +def _parse_user_ids(user_ids: str) -> list[str]: + return [user_id.strip() for user_id in user_ids.split(",") if user_id.strip()] + + def main() -> int: parser = argparse.ArgumentParser(description="Run the Feast Chronon demo.") mode = parser.add_mutually_exclusive_group() mode.add_argument("--offline-only", action="store_true") mode.add_argument("--online-only", action="store_true") + parser.add_argument( + "--scenario", + choices=["basic", "checkout-risk"], + default="basic", + help="Demo scenario to run.", + ) parser.add_argument( "--service-url", default=os.environ.get("CHRONON_SERVICE_URL", "http://127.0.0.1:9000"), help="Chronon service URL for the online demo.", ) + parser.add_argument( + "--user-ids", + default=",".join(CHECKOUT_RISK_DEFAULT_USER_IDS), + help="Comma-separated user IDs for the checkout-risk scenario.", + ) args = parser.parse_args() if not args.online_only: @@ -191,9 +391,32 @@ def main() -> int: print(offline_result.to_string(index=False)) if not args.offline_only: - online_result = run_online_demo(args.service_url) - print("\nOnline quickstart features:") - print(json.dumps(online_result, indent=2, sort_keys=True)) + if args.scenario == "checkout-risk": + checkout_result = run_checkout_risk_demo( + args.service_url, + _parse_user_ids(args.user_ids), + ) + print("\nCheckout risk registry objects:") + print(json.dumps(checkout_result["registry_objects"], indent=2)) + print("\nCheckout risk feature refs:") + print(json.dumps(checkout_result["feature_refs"], indent=2)) + print("\nDirect Chronon join response:") + print( + json.dumps(checkout_result["direct_chronon"], indent=2, sort_keys=True) + ) + print("\nFeast FeatureService online response:") + print(json.dumps(checkout_result["feast_online"], indent=2, sort_keys=True)) + print("\nCheckout risk summary:") + print( + pd.DataFrame(checkout_result["checkout_risk_summary"]).to_string( + index=False, + na_rep="null", + ) + ) + else: + online_result = run_online_demo(args.service_url) + print("\nOnline quickstart features:") + print(json.dumps(online_result, indent=2, sort_keys=True)) return 0 diff --git a/sdk/python/tests/unit/examples/test_chronon_demo.py b/sdk/python/tests/unit/examples/test_chronon_demo.py new file mode 100644 index 00000000000..01f0dbcce0e --- /dev/null +++ b/sdk/python/tests/unit/examples/test_chronon_demo.py @@ -0,0 +1,69 @@ +import importlib.util +from pathlib import Path + + +def _load_chronon_demo(): + repo_root = Path(__file__).resolve().parents[5] + module_path = repo_root / "examples" / "chronon" / "run_demo.py" + spec = importlib.util.spec_from_file_location("chronon_run_demo", module_path) + assert spec is not None + assert spec.loader is not None + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def test_checkout_risk_feature_repo_registers_expected_objects(tmp_path): + demo = _load_chronon_demo() + + store, feature_service, feature_refs = demo.create_checkout_risk_feature_store( + tmp_path, "http://chronon.test" + ) + + assert feature_service.name == "checkout_risk_v1" + assert feature_refs == [ + f"checkout_risk_features:{feature_name}" + for feature_name in demo.CHECKOUT_RISK_FEATURES + ] + assert [entity.name for entity in store.list_entities()] == ["user"] + assert [view.name for view in store.list_feature_views()] == [ + "checkout_risk_features" + ] + assert [service.name for service in store.list_feature_services()] == [ + "checkout_risk_v1" + ] + + +def test_checkout_risk_summary_marks_missing_users(): + demo = _load_chronon_demo() + + rows = demo.summarize_checkout_risk_response( + { + "user_id": ["5", "999999"], + demo.PURCHASE_SUM_30D: [1253, None], + demo.PURCHASE_COUNT_30D: [5, None], + demo.REFUND_SUM_30D: [1269, None], + demo.REFUND_COUNT_30D: [5, None], + } + ) + + assert rows == [ + { + "user_id": "5", + "purchase_sum_30d": 1253, + "purchase_count_30d": 5, + "refund_sum_30d": 1269, + "refund_count_30d": 5, + "refund_to_purchase_ratio_30d": 1.013, + "status": "features_found", + }, + { + "user_id": "999999", + "purchase_sum_30d": None, + "purchase_count_30d": None, + "refund_sum_30d": None, + "refund_count_30d": None, + "refund_to_purchase_ratio_30d": None, + "status": "missing_features", + }, + ] From 278fbcc8d4db630b54430f28dcd1193478af893a Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Fri, 4 Sep 2026 23:34:21 -0400 Subject: [PATCH 05/11] fix: Correct Chronon retrieval and source handling Signed-off-by: Francisco Javier Arceo --- .../chronon/start-local-chronon-service.sh | 11 ++- .../contrib/chronon_offline_store/chronon.py | 6 +- .../chronon_offline_store/chronon_source.py | 15 ++- .../chronon_online_store/chronon.py | 30 ++++-- .../test_chronon_retrieval.py | 92 +++++++++++++++++++ .../test_chronon_source.py | 38 ++++++++ .../test_chronon_online_store.py | 86 ++++++++++++++++- .../test_chronon_local_service_script.py | 80 ++++++++++++++++ 8 files changed, 344 insertions(+), 14 deletions(-) create mode 100644 sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py diff --git a/infra/scripts/chronon/start-local-chronon-service.sh b/infra/scripts/chronon/start-local-chronon-service.sh index 5aed0d0ffc1..f2b3536350a 100755 --- a/infra/scripts/chronon/start-local-chronon-service.sh +++ b/infra/scripts/chronon/start-local-chronon-service.sh @@ -105,10 +105,15 @@ wait_for_mongo() { wait_for_data_load() { local attempts=90 - until docker logs "${MAIN_CONTAINER}" 2>&1 | grep -q "Spark session available as 'spark'"; do + until docker exec "${MAIN_CONTAINER}" test -f /tmp/chronon-data-load.complete; do + if [[ "$(docker inspect --format '{{.State.Running}}' "${MAIN_CONTAINER}")" != "true" ]]; then + echo "Chronon quickstart data loader exited before completing." >&2 + docker logs "${MAIN_CONTAINER}" >&2 || true + exit 1 + fi attempts=$((attempts - 1)) if [[ "${attempts}" -le 0 ]]; then - echo "Chronon quickstart data loader did not initialize Spark in time." >&2 + echo "Chronon quickstart data loader did not complete in time." >&2 exit 1 fi sleep 2 @@ -180,7 +185,7 @@ docker run -d \ -e "CHRONON_ONLINE_ARGS=-Zuser=admin -Zpassword=admin -Zhost=${MONGO_CONTAINER} -Zport=27017 -Zdatabase=admin" \ -v "${CHRONON_DIR}/quickstart/mongo-online-impl:/srv/onlineImpl" \ ezvz/chronon \ - bash -lc '/opt/spark/bin/spark-shell -i scripts/data-loader.scala && tail -f /dev/null' >/dev/null + bash -lc '/opt/spark/bin/spark-shell -i scripts/data-loader.scala && touch /tmp/chronon-data-load.complete && tail -f /dev/null' >/dev/null wait_for_data_load run_quickstart_online_prep diff --git a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py index c99210c8618..5c2acfb35c4 100644 --- a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py +++ b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py @@ -20,6 +20,7 @@ DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL, assert_expected_columns_in_entity_df, get_expected_join_keys, + infer_event_timestamp_from_entity_df, ) from feast.infra.registry.base_registry import BaseRegistry from feast.on_demand_feature_view import OnDemandFeatureView @@ -199,7 +200,9 @@ def evaluate_non_entity_retrieval() -> pd.DataFrame: ) entity_df = utils.make_df_tzaware(entity_df) - entity_event_timestamp_col = DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL + entity_event_timestamp_col = infer_event_timestamp_from_entity_df( + entity_df.dtypes.to_dict() + ) expected_join_keys = get_expected_join_keys(project, feature_views, registry) assert_expected_columns_in_entity_df( entity_df.dtypes.to_dict(), @@ -281,6 +284,7 @@ def evaluate_historical_retrieval() -> pd.DataFrame: left_on=entity_event_timestamp_col, right_on=timestamp_col, direction="backward", + tolerance=feature_view.ttl or None, ) joined_frames.append(joined) diff --git a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py index f3230736aba..7e9b8229bb3 100644 --- a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py +++ b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py @@ -99,6 +99,19 @@ def __init__( owner=owner, ) + def __hash__(self) -> int: + return super().__hash__() + + def __eq__(self, other: object) -> bool: + return ( + isinstance(other, ChrononSource) + and super().__eq__(other) + and self.materialization_path == other.materialization_path + and self.chronon_join == other.chronon_join + and self.chronon_group_by == other.chronon_group_by + and self.online_endpoint == other.online_endpoint + ) + @property def materialization_path(self) -> str: return self._chronon_options.materialization_path @@ -167,5 +180,5 @@ def get_table_column_names_and_types( resolved_path = FileSource.get_uri_for_file_path( repo_path=config.repo_path, uri=self.materialization_path ) - schema = ds.dataset(resolved_path, format="parquet").schema + schema = ds.dataset(resolved_path, format="parquet", partitioning="hive").schema return [(field.name, str(field.type)) for field in schema] diff --git a/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py b/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py index aacdb87b1b3..52b39b04694 100644 --- a/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py +++ b/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py @@ -54,15 +54,21 @@ def _build_url(config: RepoConfig, table: FeatureView) -> str: ) @staticmethod - def _entity_key_to_request_row(entity_key: EntityKeyProto) -> Dict[str, Any]: + def _entity_key_to_request_row( + entity_key: EntityKeyProto, reverse_field_mapping: Dict[str, str] + ) -> Dict[str, Any]: return { - join_key: feast_value_type_to_python_type(value) + reverse_field_mapping.get( + join_key, join_key + ): feast_value_type_to_python_type(value) for join_key, value in zip(entity_key.join_keys, entity_key.entity_values) } @staticmethod def _feature_values_to_proto( - response_features: Dict[str, Any], requested_features: Optional[List[str]] + response_features: Dict[str, Any], + requested_features: Optional[List[str]], + feature_types: Dict[str, ValueType], ) -> Dict[str, ValueProto]: if requested_features is not None: response_features = { @@ -73,7 +79,7 @@ def _feature_values_to_proto( result: Dict[str, ValueProto] = {} for feature_name, value in response_features.items(): result[feature_name] = python_values_to_proto_values( - [value], ValueType.UNKNOWN + [value], feature_types.get(feature_name, ValueType.UNKNOWN) )[0] return result @@ -101,8 +107,15 @@ def online_read( assert isinstance(config.online_store, ChrononOnlineStoreConfig) url = self._build_url(config, table) + source = self._get_chronon_source(table) + field_mapping = source.field_mapping + reverse_field_mapping = {value: key for key, value in field_mapping.items()} + feature_types = { + feature.name: feature.dtype.to_value_type() for feature in table.features + } payload = [ - self._entity_key_to_request_row(entity_key) for entity_key in entity_keys + self._entity_key_to_request_row(entity_key, reverse_field_mapping) + for entity_key in entity_keys ] session = HttpSessionManager.get_session( config.auth_config, @@ -139,7 +152,12 @@ def online_read( raise RuntimeError( "Chronon response row expected `features` to be a JSON object." ) - feature_values = self._feature_values_to_proto(features, requested_features) + features = { + field_mapping.get(key, key): value for key, value in features.items() + } + feature_values = self._feature_values_to_proto( + features, requested_features, feature_types + ) output.append((None, feature_values)) return output diff --git a/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py b/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py new file mode 100644 index 00000000000..167229e23ac --- /dev/null +++ b/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py @@ -0,0 +1,92 @@ +from datetime import timedelta +from pathlib import Path + +import pandas as pd +import pytest + +from feast import ChrononSource, Entity, FeatureStore, FeatureView, Field, RepoConfig +from feast.types import Float32 + + +def _store(tmp_path: Path, ttl: timedelta, partitioned: bool = False) -> FeatureStore: + data_path = tmp_path / "materialization" + pd.DataFrame( + { + "user_id": [1, 2], + "event_timestamp": pd.to_datetime(["2024-01-01", "2024-01-01"], utc=True), + "feature_a": [2.0, 4.0], + } + ).to_parquet(data_path, partition_cols=["user_id"] if partitioned else None) + config = RepoConfig( + project="test", + registry=str(tmp_path / "registry.db"), + provider="chronon", + offline_store={"type": "chronon"}, + online_store={"type": "sqlite", "path": str(tmp_path / "online.db")}, + ) + config.repo_path = tmp_path + store = FeatureStore(config=config) + user = Entity(name="user", join_keys=["user_id"]) + view = FeatureView( + name="profile", + entities=[user], + ttl=ttl, + schema=[Field(name="feature_a", dtype=Float32)], + source=ChrononSource( + materialization_path=str(data_path), timestamp_field="event_timestamp" + ), + ) + store.apply([user, view]) + return store + + +@pytest.mark.parametrize("ttl", [timedelta(days=1), timedelta(0)]) +def test_historical_retrieval_honors_ttl(tmp_path: Path, ttl: timedelta) -> None: + store = _store(tmp_path, ttl) + entity_df = pd.DataFrame( + { + "user_id": [1, 1, 1], + "event_timestamp": pd.to_datetime( + ["2024-01-02", "2024-01-02 00:00:01", "2024-01-10"], + format="mixed", + utc=True, + ), + } + ) + result = store.get_historical_features( + entity_df=entity_df, features=["profile:feature_a"] + ).to_df() + assert result["feature_a"].iloc[0] == 2.0 + if ttl: + assert result["feature_a"].iloc[1:].isna().all() + else: + assert result["feature_a"].tolist() == [2.0, 2.0, 2.0] + + +def test_historical_retrieval_infers_entity_timestamp(tmp_path: Path) -> None: + store = _store(tmp_path, timedelta(days=1)) + entity_df = pd.DataFrame( + {"user_id": [1], "request_time": pd.to_datetime(["2024-01-02"], utc=True)} + ) + result = store.get_historical_features( + entity_df=entity_df, features=["profile:feature_a"] + ).to_df() + assert result["feature_a"].tolist() == [2.0] + pd.testing.assert_series_equal(result["request_time"], entity_df["request_time"]) + + +def test_historical_retrieval_infers_partitioned_entity(tmp_path: Path) -> None: + store = _store(tmp_path, timedelta(days=1), partitioned=True) + assert store.get_feature_view("profile").join_keys == ["user_id"] + result = store.get_historical_features( + entity_df=pd.DataFrame( + { + "user_id": [2, 1], + "event_timestamp": pd.to_datetime( + ["2024-01-02", "2024-01-02"], utc=True + ), + } + ), + features=["profile:feature_a"], + ).to_df() + assert result["feature_a"].tolist() == [4.0, 2.0] diff --git a/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_source.py b/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_source.py index 8ea8434ea8a..9a328df8218 100644 --- a/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_source.py +++ b/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_source.py @@ -3,6 +3,7 @@ import pandas as pd import pytest +from feast import FeatureStore, RepoConfig from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( ChrononSource, ) @@ -103,3 +104,40 @@ def test_chronon_source_requires_materialization_path(): chronon_join="team/training_set.v1", timestamp_field="event_timestamp", ) + + +@pytest.mark.parametrize( + "option,initial,updated", + [ + ("materialization_path", "old.parquet", "new.parquet"), + ("chronon_join", "team/old.v1", "team/new.v2"), + ("chronon_group_by", "team/old.v1", "team/new.v2"), + ("online_endpoint", "http://old.test", "http://new.test"), + ], +) +def test_apply_updates_chronon_source_options( + tmp_path: Path, option: str, initial: str, updated: str +) -> None: + config = RepoConfig( + project="test", + registry=str(tmp_path / "registry.db"), + provider="chronon", + offline_store={"type": "chronon"}, + online_store={"type": "sqlite", "path": str(tmp_path / "online.db")}, + ) + config.repo_path = tmp_path + store = FeatureStore(config=config) + for value in [initial, updated]: + options = { + "name": "source", + "materialization_path": str(tmp_path / "source.parquet"), + "timestamp_field": "event_timestamp", + "chronon_join": "team/features.v1", + } + if option == "chronon_group_by": + options.pop("chronon_join") + options[option] = value + source = ChrononSource(**options) + store.apply([source]) + assert getattr(store.get_data_source("source"), option) == updated + assert hash(source) == hash(store.get_data_source("source")) diff --git a/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py b/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py index 2501a2d3d60..e87ca8bfdb5 100644 --- a/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py +++ b/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py @@ -1,9 +1,10 @@ from pathlib import Path +from typing import Any import pandas as pd import pytest -from feast import Entity, FeatureView, Field +from feast import Entity, FeatureStore, FeatureView, Field from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import ( ChrononSource, ) @@ -14,7 +15,7 @@ from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto from feast.protos.feast.types.Value_pb2 import Value as ValueProto from feast.repo_config import RegistryConfig, RepoConfig -from feast.types import Float32, Int64 +from feast.types import Array, FeastType, Float32, Int32, Int64, Map from feast.value_type import ValueType @@ -121,7 +122,7 @@ def post(self, url, json, timeout, verify): assert captured["url"].endswith("/v1/features/join/team%2Ftraining_set.v1") assert captured["json"] == [{"user_id": 1}, {"user_id": 2}] assert rows[0][1] is not None - assert abs(rows[0][1]["feature_a"].double_val - 0.5) < 1e-6 + assert rows[0][1]["feature_a"] == ValueProto(float_val=0.5) assert rows[1] == (None, None) @@ -288,3 +289,82 @@ def post(self, url, json, timeout, verify): _entity_keys(), requested_features=["feature_a"], ) + + +@pytest.mark.parametrize( + "dtype,value,expected", + [ + (Float32, 0.5, ValueProto(float_val=0.5)), + (Int32, 3, ValueProto(int32_val=3)), + (Array(Int64), [], ValueProto(int64_list_val={"val": []})), + (Map, {}, ValueProto(map_val={})), + (Float32, None, ValueProto()), + ], +) +def test_online_read_preserves_schema( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, + dtype: FeastType, + value: Any, + expected: ValueProto, +) -> None: + source = ChrononSource( + materialization_path=str(_write_chronon_parquet(tmp_path)), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ) + view = _feature_view(source) + view.features = [Field(name="feature_a", dtype=dtype)] + + class Session: + def post(self, *args: Any, **kwargs: Any) -> _Response: + return _Response( + {"results": [{"status": "Success", "features": {"feature_a": value}}]} + ) + + monkeypatch.setattr( + "feast.infra.online_stores.chronon_online_store.chronon.HttpSessionManager.get_session", + lambda *args, **kwargs: Session(), + ) + rows = ChrononOnlineStore().online_read( + _repo_config(tmp_path), view, _entity_keys()[:1], ["feature_a"] + ) + assert rows == [(None, {"feature_a": expected})] + + +def test_online_read_applies_source_field_mapping( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + source = ChrononSource( + materialization_path=str(_write_chronon_parquet(tmp_path)), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + field_mapping={"user_id": "customer_id", "feature_a": "renamed"}, + ) + store = FeatureStore(config=_repo_config(tmp_path)) + customer = Entity( + name="customer", join_keys=["customer_id"], value_type=ValueType.INT64 + ) + view = FeatureView( + name="profile", + entities=[customer], + schema=[Field(name="renamed", dtype=Float32)], + source=source, + ) + store.apply([customer, view]) + + class Session: + def post(self, url: str, json: Any, **kwargs: Any) -> _Response: + assert json == [{"user_id": 1}] + return _Response( + {"results": [{"status": "Success", "features": {"feature_a": 2.0}}]} + ) + + monkeypatch.setattr( + "feast.infra.online_stores.chronon_online_store.chronon.HttpSessionManager.get_session", + lambda *args, **kwargs: Session(), + ) + result = store.get_online_features( + features=["profile:renamed"], entity_rows=[{"customer_id": 1}] + ).to_dict() + assert result == {"customer_id": [1], "renamed": [2.0]} diff --git a/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py b/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py index 4c59ccb4f8d..c04260efc4f 100644 --- a/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py +++ b/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py @@ -1,7 +1,10 @@ import os import subprocess +import sys from pathlib import Path +import pytest + def _script_path() -> Path: return ( @@ -38,3 +41,80 @@ def test_start_script_can_fail_before_docker_when_repo_missing(tmp_path: Path): assert str(missing_repo) in result.stderr assert "CHRONON_REPO" in result.stderr assert "git clone" in result.stderr + + +@pytest.mark.parametrize("loader_fails", [False, True]) +def test_start_script_waits_for_completed_data_load( + tmp_path: Path, loader_fails: bool +) -> None: + chronon_repo = tmp_path / "chronon" + jar = ( + chronon_repo + / "quickstart/mongo-online-impl/target/scala-2.12/mongo-online-impl-assembly-0.1.0-SNAPSHOT.jar" + ) + jar.parent.mkdir(parents=True) + jar.touch() + bin_dir = tmp_path / "bin" + bin_dir.mkdir() + docker = bin_dir / "docker" + # Model a fresh container: Spark is initialized before the loader has + # completed. Uploading during that interval must not be allowed. + docker.write_text( + f"#!{sys.executable}\n" + """ +import os +import sys +from pathlib import Path + +args = sys.argv[1:] +state = Path(os.environ['TEST_DOCKER_STATE']) +failed = os.environ['TEST_LOADER_FAILS'] == '1' +if args[0] == 'run' and 'chronon-main' in args: + state.write_text('0') +elif args[:2] == ['logs', 'chronon-main']: + print("Spark session available as 'spark'.") +elif args[:3] == ['exec', 'chronon-main', 'test']: + polls = int(state.read_text()) + 1 + state.write_text(str(polls)) + sys.exit(0 if polls >= 2 and not failed else 1) +elif args[0] == 'inspect': + print('false' if failed else 'true') +elif args[:3] == ['exec', 'chronon-main', 'bash']: + if failed or int(state.read_text()) < 2: + print('Upload started before successful data load', file=sys.stderr) + sys.exit(17) + state.with_suffix('.uploaded').touch() +""" + ) + docker.chmod(0o755) + for command in ["sleep", "curl"]: + executable = bin_dir / command + executable.write_text("#!/bin/sh\nexit 0\n") + executable.chmod(0o755) + state = tmp_path / "docker-state" + result = subprocess.run( + ["bash", str(_script_path())], + env={ + **os.environ, + "PATH": f"{bin_dir}{os.pathsep}{os.environ['PATH']}", + "CHRONON_REPO": str(chronon_repo), + "CHRONON_SERVICE_JAR": str(jar), + "CHRONON_SERVICE_PID_FILE": str(tmp_path / "service.pid"), + "CHRONON_PREFLIGHT_ONLY": "0", + "PYTHON_BIN": "/usr/bin/true", + "TEST_DOCKER_STATE": str(state), + "TEST_LOADER_FAILS": "1" if loader_fails else "0", + }, + capture_output=True, + text=True, + timeout=15, + check=False, + ) + if loader_fails: + assert result.returncode == 1 + assert not state.with_suffix(".uploaded").exists() + assert "data loader exited" in result.stderr + else: + assert result.returncode == 0, result.stderr + assert state.with_suffix(".uploaded").exists() + assert "CHRONON_SERVICE_URL=" in result.stdout From 158f0f8e0a06fca425c3f209ab6da1b5133dc970 Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Wed, 9 Sep 2026 15:08:57 -0400 Subject: [PATCH 06/11] ci: Include CPU PyTorch hashes in CI locks Signed-off-by: Francisco Javier Arceo --- Makefile | 1 + infra/scripts/add_cpu_torch_hashes.py | 79 +++++++++++++++++++ .../requirements/py3.10-ci-requirements.txt | 53 ++++++++++++- .../requirements/py3.11-ci-requirements.txt | 53 ++++++++++++- .../requirements/py3.12-ci-requirements.txt | 53 ++++++++++++- .../infra/scripts/test_cpu_torch_hashes.py | 36 +++++++++ 6 files changed, 269 insertions(+), 6 deletions(-) create mode 100644 infra/scripts/add_cpu_torch_hashes.py create mode 100644 sdk/python/tests/unit/infra/scripts/test_cpu_torch_hashes.py diff --git a/Makefile b/Makefile index d5a6aeeaba9..41093074db6 100644 --- a/Makefile +++ b/Makefile @@ -141,6 +141,7 @@ lock-python-dependencies-all: ## Recompile and lock all Python dependency sets f pixi run --environment $(call get_env_name,$(ver)) --manifest-path infra/scripts/pixi/pixi.toml \ "uv pip compile -p $(ver) --no-strip-extras pyproject.toml --extra ci \ --generate-hashes --output-file sdk/python/requirements/py$(ver)-ci-requirements.txt" && \ + python3 infra/scripts/add_cpu_torch_hashes.py --python-version $(ver) sdk/python/requirements/py$(ver)-ci-requirements.txt && \ pixi run --environment $(call get_env_name,$(ver)) --manifest-path infra/scripts/pixi/pixi.toml \ "uv pip compile -p $(ver) --no-strip-extras pyproject.toml \ --generate-hashes --output-file sdk/python/requirements/py$(ver)-requirements.txt" && \ diff --git a/infra/scripts/add_cpu_torch_hashes.py b/infra/scripts/add_cpu_torch_hashes.py new file mode 100644 index 00000000000..bf5ce4b9447 --- /dev/null +++ b/infra/scripts/add_cpu_torch_hashes.py @@ -0,0 +1,79 @@ +"""Add CPU wheel hashes to CI locks while retaining their PyPI artifacts and pins.""" + +from __future__ import annotations + +import argparse +import re +import subprocess +import tempfile +from pathlib import Path + +TORCH_REQUIREMENT = re.compile( + r"^(torch|torchvision)==([^\s]+)[^\n]*\n(?: --hash=[^\n]+\n)+", + re.MULTILINE, +) + + +def add_cpu_hashes(requirements: str, cpu_requirements: str) -> str: + cpu_hashes = { + (match[1], match[2]): set(re.findall(r"sha256:[0-9a-f]{64}", match[0])) + for match in TORCH_REQUIREMENT.finditer(cpu_requirements) + } + + def add_hashes(match: re.Match[str]) -> str: + name, version = match[1], match[2] + hashes = cpu_hashes.get((name, f"{version}+cpu")) + if not hashes: + raise ValueError(f"Missing CPU hashes for {name}=={version}") + hashes = hashes | set(re.findall(r"sha256:[0-9a-f]{64}", match[0])) + header = match[0].splitlines()[0] + return ( + header + + "\n" + + " \\\n".join(f" --hash={digest}" for digest in sorted(hashes)) + + "\n" + ) + + return TORCH_REQUIREMENT.sub(add_hashes, requirements) + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("requirements", type=Path) + parser.add_argument("--python-version", required=True) + args = parser.parse_args() + contents = args.requirements.read_text() + pins = [f"{match[1]}=={match[2]}" for match in TORCH_REQUIREMENT.finditer(contents)] + if not pins: + raise ValueError("No hashed PyTorch requirements found") + with tempfile.TemporaryDirectory() as tmp: + source = Path(tmp) / "torch.in" + output = Path(tmp) / "torch.txt" + source.write_text("\n".join(pins) + "\n") + subprocess.run( + [ + "uv", + "pip", + "compile", + "--no-deps", + "--torch-backend", + "cpu", + "--universal", + "--python-version", + args.python_version, + "--generate-hashes", + "--no-header", + "--no-annotate", + "--quiet", + str(source), + "--output-file", + str(output), + ], + check=True, + ) + updated = add_cpu_hashes(contents, output.read_text()) + args.requirements.write_text(updated) + + +if __name__ == "__main__": + main() diff --git a/sdk/python/requirements/py3.10-ci-requirements.txt b/sdk/python/requirements/py3.10-ci-requirements.txt index c5244c79a07..3e15c0a3b47 100644 --- a/sdk/python/requirements/py3.10-ci-requirements.txt +++ b/sdk/python/requirements/py3.10-ci-requirements.txt @@ -6355,29 +6355,60 @@ toolz==1.1.0 \ # partd torch==2.13.0 \ --hash=sha256:024c6cc0c1b085f2f91f20a3dc27b0471d021c31ce84b81be3afdc39f791fd9d \ + --hash=sha256:0555fde6108ca90247ae33d4e1237cbae475c86a223bb2f0f91d9addf1f611bd \ --hash=sha256:092790c696a760c729fd5722835f50b9d81fd7c8f141571f3f3cf4081a8f664c \ --hash=sha256:0ab4b69f3ee03a62a002cfbf77b1ca5e88aceb4ea64cb4388bb28f638ddbb045 \ + --hash=sha256:0b8f7d0423027ae8b90c7977c627f3379f325363a08224dffad9b4b2d684a83d \ + --hash=sha256:10717d8b3b67c45a4788bf7ffc0bab1ea1e5ebbedd24466be6100102d141fac1 \ + --hash=sha256:1a3a35229fdc13446b4eab50e7fcf9399ff941e89a3b761497786297a5d8dde5 \ --hash=sha256:1e09d6a722504957c694faceca843acde562786df1144ebcc5a74075ec7f6005 \ + --hash=sha256:222a6681467cc7f6f05cd3068dfbc603def3a1e46d1d4620c1c8cdf6178bd563 \ + --hash=sha256:2b3d093abd919ad934c43d47e73ba63ceba7cbd7269fc2e9c1e4fc29e8fe45fa \ --hash=sha256:2bd30b6b730d987fa386ce3898933762c5cb8cc82eb0535211d787cc3ce2dfeb \ --hash=sha256:2fe228aba290d14b9f31b049be550dbd469c3fd3013d7a19705b30454da97027 \ --hash=sha256:31061ff56ed8fbf26c749806905aeb749ebeb819810fd5d52508aa5afd90dddc \ --hash=sha256:33449899ce5496c1b84b4853179d94fd102028ae1407314d9fb956bb79e70d09 \ + --hash=sha256:3bbb357161e8db43ba7cdcc7e03561eba0c449392f2f27d3566887198fcb4ead \ + --hash=sha256:3fbf9c9d1f3c10c2d59d04aca426dee9ccc6ceb32d255c61e93acc3b4f75fae6 \ --hash=sha256:49b58f1e2c52440abb6f17c28f0335fe6c6d01ad1a7f55b0183b81e4b34d64e6 \ --hash=sha256:49f1ea385c754e54919408a9bb3b5a72b0b755bbe2c916c1d6f70afbec4908a2 \ + --hash=sha256:4ca4a9394b0c771238a4f73590fdbbc4debad85ed0fa63d026ae1b085da7d6e2 \ --hash=sha256:4f8573e3ce9ebcd53fe922f01077a6085ccdfbe5f12fd215883a9d87d7a744fd \ --hash=sha256:572df8be8ffb4599c88cbd6a0726f1f854f4da65d2e3c09f0e2c2283333cd6d4 \ --hash=sha256:60fcdcb2f3876e21146cb4524ef06397d727ca9ad5f020818547e25075fe3cb7 \ + --hash=sha256:6746dbcbeb526eb61330b76b41ff1b4eb848951103a892eeb080dfa2b264667b \ + --hash=sha256:6e9817dbdf5ea76789babd46e457eac5bf14ff566cf85f8addbfdff2d56601ce \ + --hash=sha256:6f307c2c32d764ffc6ff6893b801fad6d4752f3e67966cb8abf1843427c02604 \ --hash=sha256:796633c4cdf0fe2cdced72d8f88f22e73dbcfce83132763162f6d4bff13b820b \ + --hash=sha256:7b8d26e29bceafbdaa8d63bfe7612f23875b5af2cc07e13f809c3ed890bbe1d8 \ + --hash=sha256:84453b69508ec79902f899c5ed9495acb9e2bbe9fda5f1d5d6f19e3c3842e1a7 \ + --hash=sha256:8e109528e6bab044815daebaf71770fbaace3a66ef1c816cb55c875350f78a60 \ + --hash=sha256:8eb5002ca81af00ae69b57540f615b58b8ae922b6d4848176b366a52bd2196e6 \ --hash=sha256:94f0de129916f77b8dc2c7a8eff644cfeddfe59e39c9f55e9f6e17543410281d \ + --hash=sha256:966d020354f465672dc7dd10d3a5c6cd17d7eb48620aa1d265b48a1f78f06898 \ + --hash=sha256:991cc14b39e751122c01f017be6448533989868731cb5eecd1006893d26787c2 \ --hash=sha256:a0d8b11f16a48d60e2015d8213aa0390744cbebb98e58b62b3514dddc656e330 \ + --hash=sha256:a17ff48608634db245e17e8bb00a9558554a49aeb1e4f5fe6cd039af2a10515b \ --hash=sha256:a3893dc2da0a972a8ca5d698c85a9f967559ac5f8ee1797b77408aa8734d073c \ --hash=sha256:a3a9a21312872af8a26950b2c15680335a386a1f56ed03e780653d78b9607e9e \ + --hash=sha256:a43376bd094124ef626bfdd3d4c2c62eacb0b5ddc99776f4a32d4fd16f1f3420 \ --hash=sha256:a7de8a313090dc5c7d7ba4bfe5c3be222528f9a4dba1acc83bddb1157360c4b8 \ + --hash=sha256:a8b450c1e58e5800e5b4691dac412f8d2d65a1dc3298166f91596603a3531e6f \ + --hash=sha256:ac7aaf322be4777765a53bed7264a214dd81b3a1d276b93150515a3c5f75e4b0 \ + --hash=sha256:b222c15a0fc2ce207d1c1a59700b46c8fa6748df1f447ad11e5c870dde0933d9 \ --hash=sha256:c28def70706c2f9ecc752574766e8ae4da9b810ab6676b611166761a78a9f1e1 \ --hash=sha256:c78b7b4d04461855a764cf01bae9a462bb88bc93defcfa11235cbc8fdf3e12c4 \ + --hash=sha256:ca021f9eb2f8345c83fa03e3a04587308afb8df71bd472670b3ece00df58621c \ --hash=sha256:cc26eead4cf51d0b544e31e364dcf000846549c273bd148936fe9d24d29acb92 \ + --hash=sha256:d20fa53ee744502fa4c69818a720b05ca0d37abd055d4f6e66cae155114bc691 \ --hash=sha256:d849b390e07d8d333ce8ecaf91b273c656c598379a19c9acf1318a883f6b391c \ - --hash=sha256:e76f9bcecc52b8ff711239a2f7547d5353df95878ab232f0773c1d95928b92f8 + --hash=sha256:dec241fef3984c0d1edadd1f58708e218d4eae881ceef7bc10cf9964d41b68b9 \ + --hash=sha256:e2e5134decf00e218da62318f3dc5df156231d367871918e91eba95ab0ad43ab \ + --hash=sha256:e76f9bcecc52b8ff711239a2f7547d5353df95878ab232f0773c1d95928b92f8 \ + --hash=sha256:f028e428bddee95cdb86e2470254e95c9af629362488550c200ed4793125a817 \ + --hash=sha256:f5cbb61180a9793d9e12fe115a2310d2600bd449dfb9a01ec5640e21359fa5ea \ + --hash=sha256:fa0762705b933624d59f6823db9ce7ec2e35b3e1e9c319c9db51fbeecfc3e319 \ + --hash=sha256:ffadde149901c8afa138daa38d898264003cfcf1a3336ca5cd964b5af227d867 # via # feast (pyproject.toml) # accelerate @@ -6390,9 +6421,14 @@ torch==2.13.0 \ torchvision==0.28.0 \ --hash=sha256:028a3d481b37d785605620d7cdad897064c5a55bae2aa1f2658766333e291940 \ --hash=sha256:09ce8f56e81f19b9c378ae7bb109f83f6659fd8bc3cd14241a48e4af46e9ed49 \ + --hash=sha256:1aa741ae0eb8668b6287dd667548e2dd10179c828db68bfdee1519763b9c5b99 \ + --hash=sha256:1dad604dfc0177ecebe0891bd9701fe2c62ec3f7819a247be541b3fb6effee99 \ + --hash=sha256:22958193d72444ed7cbcc665ba4821a31e5279f9c4d1ad08520918b30896b78a \ --hash=sha256:2a1ef4b6f4bf5828b48cfad97372c8982db906830884b2868ba5c3df937a7d81 \ + --hash=sha256:2f768c4f6d5adf6d5535061fd69ec44827608bac0e96e12114942a6fdfce1107 \ --hash=sha256:3557cc7b539f46dabcda2b6f2b14017ccbeef024de466d4fc5835fc3f287f769 \ --hash=sha256:36beb0782976906069ca03d4c9aacaf4b6b838b06ed6c20960ea9c51cce7acdd \ + --hash=sha256:3a1a76c8decb1d7bbedd3588bccc90fb269944b7321a773db181735b42115422 \ --hash=sha256:3bd9dba55224a9db4a2d77f6feaa5651770d8c8e86d3d0ddb0fa6bec54c8712b \ --hash=sha256:46f581979c010ad6da6bd85ee602aa707e1ff44312670223b7a0ee517ad06d47 \ --hash=sha256:546fd85345cf8652f6cd099d4f9884b0ca5c2f3fae78689a21dd2f35ea6b622f \ @@ -6400,18 +6436,31 @@ torchvision==0.28.0 \ --hash=sha256:5cf78ebc401ce64ae19b8c55de866bb836797d559a4de9c25ccbe74cfa642d3a \ --hash=sha256:62c7d110f86a039245b587e4fae60278c649f3bd42ff79cfbc1178eca4e72542 \ --hash=sha256:6dfb0f45e2b4ceb4e76f158c3fbb5f44387099f3c466e3423a09ab665a194aba \ + --hash=sha256:7b6667fd0172463be2a271fb0dbd44b31a7891afd549a66208613ce4cdd79f88 \ + --hash=sha256:7d81da2804da52c9788f2d5a8d0aaddcea9fce6eb5d7c6e19a32b40b4ed0b75a \ --hash=sha256:7e80f543b22503d9415e126db5f0ff3917036925e38560ee6b9ae38c571a4002 \ --hash=sha256:7e9dd6f60d6e15f8dc27d4f877fdb6002fc70d70272412135f1c2ff9cfa08d3b \ --hash=sha256:7fad44dc9582570c7d92c4487d36ac46998f40cc39b438e8b8f5111a935ce4e8 \ + --hash=sha256:82dbffb63d61cd43d9c7a311588e665aa2b21173a05f852b4d384d6782fd88ef \ --hash=sha256:83fe6c020866a85acd7d97deccc45ff11d66daf42916d04396a4309c66c0ccb8 \ + --hash=sha256:870d0d42f2eb80f4870cd35e51eea52f596a408a671b28136f06a808846f24c5 \ + --hash=sha256:879ae6d4e2e3651582fb7187eafd535601cb5d019595d47e2c874262a000e88e \ --hash=sha256:87dc16b2df427c1318ad335f1e2be2b3b15b2cf20f7934c83b0505a48425ee5d \ --hash=sha256:89f90e29b0966352811b12589f3a3c61943bf2bb9487b9d7bbec10efb1096bb5 \ + --hash=sha256:8d8b98608779c770ede5e20609772453ebc7487ebb8697445d1856466c542f45 \ --hash=sha256:904cf89af220f8c6b2ed0296bb5065b474ce43b77558e48b2bf9de8b0ba17204 \ --hash=sha256:9a45ea67235d965ef52187130d20002a4de20c54ea3d927a24286961d268dc37 \ --hash=sha256:ad7b3a439265cc3739a4ab5b4c998c0e38ea99c0ee7ca4dea35c5d0b099ec237 \ + --hash=sha256:b545d46f4d2f9d30381281cf22874bfe1d32a8a7b0ee8396fccde89f30c6a9d9 \ --hash=sha256:bb6dd6918460ed89cc7644adcc2402991474d6933cf1ce92b390641cb233fddf \ + --hash=sha256:c6373ec4c2f922e89f45ac91889404d312ba29a31f205b0ad9a725a3894ca246 \ + --hash=sha256:cf5d1c4c355c5b487e7d1c681ef28b9caa2ff0dfa3a32fdcd9e98206a1462bf4 \ + --hash=sha256:d2a0171faa211b506c4dcf3a036942a41077c5d2d3d94883dafbda7b8624a3eb \ --hash=sha256:d483b4aa3f5237569053f749cd1a2b5bb548ca456e40461a5dd087f21149d123 \ - --hash=sha256:e9f54c30cd52e3ef7fd034cc69b7bb7e0964e1c8f8743e018ab92e95b40f9eee + --hash=sha256:d63eae114b4d1fca2b294d300cea3f0d6c71b6d132641e0c4cab1aa06a467b0d \ + --hash=sha256:d88db83abbdfb97199979ec94dd427bc372c1b9ab01f0dbed20af05b0bd644b1 \ + --hash=sha256:e9f54c30cd52e3ef7fd034cc69b7bb7e0964e1c8f8743e018ab92e95b40f9eee \ + --hash=sha256:fc38699d69d11e563a5b1c02f621f639c4caa9e2ffe6b1ddd4aceedffc0d0578 # via # feast (pyproject.toml) # docling-ibm-models diff --git a/sdk/python/requirements/py3.11-ci-requirements.txt b/sdk/python/requirements/py3.11-ci-requirements.txt index eb14d9ead37..ce48f2256d1 100644 --- a/sdk/python/requirements/py3.11-ci-requirements.txt +++ b/sdk/python/requirements/py3.11-ci-requirements.txt @@ -6592,29 +6592,60 @@ toolz==1.1.0 \ # partd torch==2.13.0 \ --hash=sha256:024c6cc0c1b085f2f91f20a3dc27b0471d021c31ce84b81be3afdc39f791fd9d \ + --hash=sha256:0555fde6108ca90247ae33d4e1237cbae475c86a223bb2f0f91d9addf1f611bd \ --hash=sha256:092790c696a760c729fd5722835f50b9d81fd7c8f141571f3f3cf4081a8f664c \ --hash=sha256:0ab4b69f3ee03a62a002cfbf77b1ca5e88aceb4ea64cb4388bb28f638ddbb045 \ + --hash=sha256:0b8f7d0423027ae8b90c7977c627f3379f325363a08224dffad9b4b2d684a83d \ + --hash=sha256:10717d8b3b67c45a4788bf7ffc0bab1ea1e5ebbedd24466be6100102d141fac1 \ + --hash=sha256:1a3a35229fdc13446b4eab50e7fcf9399ff941e89a3b761497786297a5d8dde5 \ --hash=sha256:1e09d6a722504957c694faceca843acde562786df1144ebcc5a74075ec7f6005 \ + --hash=sha256:222a6681467cc7f6f05cd3068dfbc603def3a1e46d1d4620c1c8cdf6178bd563 \ + --hash=sha256:2b3d093abd919ad934c43d47e73ba63ceba7cbd7269fc2e9c1e4fc29e8fe45fa \ --hash=sha256:2bd30b6b730d987fa386ce3898933762c5cb8cc82eb0535211d787cc3ce2dfeb \ --hash=sha256:2fe228aba290d14b9f31b049be550dbd469c3fd3013d7a19705b30454da97027 \ --hash=sha256:31061ff56ed8fbf26c749806905aeb749ebeb819810fd5d52508aa5afd90dddc \ --hash=sha256:33449899ce5496c1b84b4853179d94fd102028ae1407314d9fb956bb79e70d09 \ + --hash=sha256:3bbb357161e8db43ba7cdcc7e03561eba0c449392f2f27d3566887198fcb4ead \ + --hash=sha256:3fbf9c9d1f3c10c2d59d04aca426dee9ccc6ceb32d255c61e93acc3b4f75fae6 \ --hash=sha256:49b58f1e2c52440abb6f17c28f0335fe6c6d01ad1a7f55b0183b81e4b34d64e6 \ --hash=sha256:49f1ea385c754e54919408a9bb3b5a72b0b755bbe2c916c1d6f70afbec4908a2 \ + --hash=sha256:4ca4a9394b0c771238a4f73590fdbbc4debad85ed0fa63d026ae1b085da7d6e2 \ --hash=sha256:4f8573e3ce9ebcd53fe922f01077a6085ccdfbe5f12fd215883a9d87d7a744fd \ --hash=sha256:572df8be8ffb4599c88cbd6a0726f1f854f4da65d2e3c09f0e2c2283333cd6d4 \ --hash=sha256:60fcdcb2f3876e21146cb4524ef06397d727ca9ad5f020818547e25075fe3cb7 \ + --hash=sha256:6746dbcbeb526eb61330b76b41ff1b4eb848951103a892eeb080dfa2b264667b \ + --hash=sha256:6e9817dbdf5ea76789babd46e457eac5bf14ff566cf85f8addbfdff2d56601ce \ + --hash=sha256:6f307c2c32d764ffc6ff6893b801fad6d4752f3e67966cb8abf1843427c02604 \ --hash=sha256:796633c4cdf0fe2cdced72d8f88f22e73dbcfce83132763162f6d4bff13b820b \ + --hash=sha256:7b8d26e29bceafbdaa8d63bfe7612f23875b5af2cc07e13f809c3ed890bbe1d8 \ + --hash=sha256:84453b69508ec79902f899c5ed9495acb9e2bbe9fda5f1d5d6f19e3c3842e1a7 \ + --hash=sha256:8e109528e6bab044815daebaf71770fbaace3a66ef1c816cb55c875350f78a60 \ + --hash=sha256:8eb5002ca81af00ae69b57540f615b58b8ae922b6d4848176b366a52bd2196e6 \ --hash=sha256:94f0de129916f77b8dc2c7a8eff644cfeddfe59e39c9f55e9f6e17543410281d \ + --hash=sha256:966d020354f465672dc7dd10d3a5c6cd17d7eb48620aa1d265b48a1f78f06898 \ + --hash=sha256:991cc14b39e751122c01f017be6448533989868731cb5eecd1006893d26787c2 \ --hash=sha256:a0d8b11f16a48d60e2015d8213aa0390744cbebb98e58b62b3514dddc656e330 \ + --hash=sha256:a17ff48608634db245e17e8bb00a9558554a49aeb1e4f5fe6cd039af2a10515b \ --hash=sha256:a3893dc2da0a972a8ca5d698c85a9f967559ac5f8ee1797b77408aa8734d073c \ --hash=sha256:a3a9a21312872af8a26950b2c15680335a386a1f56ed03e780653d78b9607e9e \ + --hash=sha256:a43376bd094124ef626bfdd3d4c2c62eacb0b5ddc99776f4a32d4fd16f1f3420 \ --hash=sha256:a7de8a313090dc5c7d7ba4bfe5c3be222528f9a4dba1acc83bddb1157360c4b8 \ + --hash=sha256:a8b450c1e58e5800e5b4691dac412f8d2d65a1dc3298166f91596603a3531e6f \ + --hash=sha256:ac7aaf322be4777765a53bed7264a214dd81b3a1d276b93150515a3c5f75e4b0 \ + --hash=sha256:b222c15a0fc2ce207d1c1a59700b46c8fa6748df1f447ad11e5c870dde0933d9 \ --hash=sha256:c28def70706c2f9ecc752574766e8ae4da9b810ab6676b611166761a78a9f1e1 \ --hash=sha256:c78b7b4d04461855a764cf01bae9a462bb88bc93defcfa11235cbc8fdf3e12c4 \ + --hash=sha256:ca021f9eb2f8345c83fa03e3a04587308afb8df71bd472670b3ece00df58621c \ --hash=sha256:cc26eead4cf51d0b544e31e364dcf000846549c273bd148936fe9d24d29acb92 \ + --hash=sha256:d20fa53ee744502fa4c69818a720b05ca0d37abd055d4f6e66cae155114bc691 \ --hash=sha256:d849b390e07d8d333ce8ecaf91b273c656c598379a19c9acf1318a883f6b391c \ - --hash=sha256:e76f9bcecc52b8ff711239a2f7547d5353df95878ab232f0773c1d95928b92f8 + --hash=sha256:dec241fef3984c0d1edadd1f58708e218d4eae881ceef7bc10cf9964d41b68b9 \ + --hash=sha256:e2e5134decf00e218da62318f3dc5df156231d367871918e91eba95ab0ad43ab \ + --hash=sha256:e76f9bcecc52b8ff711239a2f7547d5353df95878ab232f0773c1d95928b92f8 \ + --hash=sha256:f028e428bddee95cdb86e2470254e95c9af629362488550c200ed4793125a817 \ + --hash=sha256:f5cbb61180a9793d9e12fe115a2310d2600bd449dfb9a01ec5640e21359fa5ea \ + --hash=sha256:fa0762705b933624d59f6823db9ce7ec2e35b3e1e9c319c9db51fbeecfc3e319 \ + --hash=sha256:ffadde149901c8afa138daa38d898264003cfcf1a3336ca5cd964b5af227d867 # via # feast (pyproject.toml) # accelerate @@ -6627,9 +6658,14 @@ torch==2.13.0 \ torchvision==0.28.0 \ --hash=sha256:028a3d481b37d785605620d7cdad897064c5a55bae2aa1f2658766333e291940 \ --hash=sha256:09ce8f56e81f19b9c378ae7bb109f83f6659fd8bc3cd14241a48e4af46e9ed49 \ + --hash=sha256:1aa741ae0eb8668b6287dd667548e2dd10179c828db68bfdee1519763b9c5b99 \ + --hash=sha256:1dad604dfc0177ecebe0891bd9701fe2c62ec3f7819a247be541b3fb6effee99 \ + --hash=sha256:22958193d72444ed7cbcc665ba4821a31e5279f9c4d1ad08520918b30896b78a \ --hash=sha256:2a1ef4b6f4bf5828b48cfad97372c8982db906830884b2868ba5c3df937a7d81 \ + --hash=sha256:2f768c4f6d5adf6d5535061fd69ec44827608bac0e96e12114942a6fdfce1107 \ --hash=sha256:3557cc7b539f46dabcda2b6f2b14017ccbeef024de466d4fc5835fc3f287f769 \ --hash=sha256:36beb0782976906069ca03d4c9aacaf4b6b838b06ed6c20960ea9c51cce7acdd \ + --hash=sha256:3a1a76c8decb1d7bbedd3588bccc90fb269944b7321a773db181735b42115422 \ --hash=sha256:3bd9dba55224a9db4a2d77f6feaa5651770d8c8e86d3d0ddb0fa6bec54c8712b \ --hash=sha256:46f581979c010ad6da6bd85ee602aa707e1ff44312670223b7a0ee517ad06d47 \ --hash=sha256:546fd85345cf8652f6cd099d4f9884b0ca5c2f3fae78689a21dd2f35ea6b622f \ @@ -6637,18 +6673,31 @@ torchvision==0.28.0 \ --hash=sha256:5cf78ebc401ce64ae19b8c55de866bb836797d559a4de9c25ccbe74cfa642d3a \ --hash=sha256:62c7d110f86a039245b587e4fae60278c649f3bd42ff79cfbc1178eca4e72542 \ --hash=sha256:6dfb0f45e2b4ceb4e76f158c3fbb5f44387099f3c466e3423a09ab665a194aba \ + --hash=sha256:7b6667fd0172463be2a271fb0dbd44b31a7891afd549a66208613ce4cdd79f88 \ + --hash=sha256:7d81da2804da52c9788f2d5a8d0aaddcea9fce6eb5d7c6e19a32b40b4ed0b75a \ --hash=sha256:7e80f543b22503d9415e126db5f0ff3917036925e38560ee6b9ae38c571a4002 \ --hash=sha256:7e9dd6f60d6e15f8dc27d4f877fdb6002fc70d70272412135f1c2ff9cfa08d3b \ --hash=sha256:7fad44dc9582570c7d92c4487d36ac46998f40cc39b438e8b8f5111a935ce4e8 \ + --hash=sha256:82dbffb63d61cd43d9c7a311588e665aa2b21173a05f852b4d384d6782fd88ef \ --hash=sha256:83fe6c020866a85acd7d97deccc45ff11d66daf42916d04396a4309c66c0ccb8 \ + --hash=sha256:870d0d42f2eb80f4870cd35e51eea52f596a408a671b28136f06a808846f24c5 \ + --hash=sha256:879ae6d4e2e3651582fb7187eafd535601cb5d019595d47e2c874262a000e88e \ --hash=sha256:87dc16b2df427c1318ad335f1e2be2b3b15b2cf20f7934c83b0505a48425ee5d \ --hash=sha256:89f90e29b0966352811b12589f3a3c61943bf2bb9487b9d7bbec10efb1096bb5 \ + --hash=sha256:8d8b98608779c770ede5e20609772453ebc7487ebb8697445d1856466c542f45 \ --hash=sha256:904cf89af220f8c6b2ed0296bb5065b474ce43b77558e48b2bf9de8b0ba17204 \ --hash=sha256:9a45ea67235d965ef52187130d20002a4de20c54ea3d927a24286961d268dc37 \ --hash=sha256:ad7b3a439265cc3739a4ab5b4c998c0e38ea99c0ee7ca4dea35c5d0b099ec237 \ + --hash=sha256:b545d46f4d2f9d30381281cf22874bfe1d32a8a7b0ee8396fccde89f30c6a9d9 \ --hash=sha256:bb6dd6918460ed89cc7644adcc2402991474d6933cf1ce92b390641cb233fddf \ + --hash=sha256:c6373ec4c2f922e89f45ac91889404d312ba29a31f205b0ad9a725a3894ca246 \ + --hash=sha256:cf5d1c4c355c5b487e7d1c681ef28b9caa2ff0dfa3a32fdcd9e98206a1462bf4 \ + --hash=sha256:d2a0171faa211b506c4dcf3a036942a41077c5d2d3d94883dafbda7b8624a3eb \ --hash=sha256:d483b4aa3f5237569053f749cd1a2b5bb548ca456e40461a5dd087f21149d123 \ - --hash=sha256:e9f54c30cd52e3ef7fd034cc69b7bb7e0964e1c8f8743e018ab92e95b40f9eee + --hash=sha256:d63eae114b4d1fca2b294d300cea3f0d6c71b6d132641e0c4cab1aa06a467b0d \ + --hash=sha256:d88db83abbdfb97199979ec94dd427bc372c1b9ab01f0dbed20af05b0bd644b1 \ + --hash=sha256:e9f54c30cd52e3ef7fd034cc69b7bb7e0964e1c8f8743e018ab92e95b40f9eee \ + --hash=sha256:fc38699d69d11e563a5b1c02f621f639c4caa9e2ffe6b1ddd4aceedffc0d0578 # via # feast (pyproject.toml) # docling-ibm-models diff --git a/sdk/python/requirements/py3.12-ci-requirements.txt b/sdk/python/requirements/py3.12-ci-requirements.txt index 4de5c1a4067..95b1955fa0c 100644 --- a/sdk/python/requirements/py3.12-ci-requirements.txt +++ b/sdk/python/requirements/py3.12-ci-requirements.txt @@ -6571,29 +6571,60 @@ toolz==1.1.0 \ # partd torch==2.13.0 \ --hash=sha256:024c6cc0c1b085f2f91f20a3dc27b0471d021c31ce84b81be3afdc39f791fd9d \ + --hash=sha256:0555fde6108ca90247ae33d4e1237cbae475c86a223bb2f0f91d9addf1f611bd \ --hash=sha256:092790c696a760c729fd5722835f50b9d81fd7c8f141571f3f3cf4081a8f664c \ --hash=sha256:0ab4b69f3ee03a62a002cfbf77b1ca5e88aceb4ea64cb4388bb28f638ddbb045 \ + --hash=sha256:0b8f7d0423027ae8b90c7977c627f3379f325363a08224dffad9b4b2d684a83d \ + --hash=sha256:10717d8b3b67c45a4788bf7ffc0bab1ea1e5ebbedd24466be6100102d141fac1 \ + --hash=sha256:1a3a35229fdc13446b4eab50e7fcf9399ff941e89a3b761497786297a5d8dde5 \ --hash=sha256:1e09d6a722504957c694faceca843acde562786df1144ebcc5a74075ec7f6005 \ + --hash=sha256:222a6681467cc7f6f05cd3068dfbc603def3a1e46d1d4620c1c8cdf6178bd563 \ + --hash=sha256:2b3d093abd919ad934c43d47e73ba63ceba7cbd7269fc2e9c1e4fc29e8fe45fa \ --hash=sha256:2bd30b6b730d987fa386ce3898933762c5cb8cc82eb0535211d787cc3ce2dfeb \ --hash=sha256:2fe228aba290d14b9f31b049be550dbd469c3fd3013d7a19705b30454da97027 \ --hash=sha256:31061ff56ed8fbf26c749806905aeb749ebeb819810fd5d52508aa5afd90dddc \ --hash=sha256:33449899ce5496c1b84b4853179d94fd102028ae1407314d9fb956bb79e70d09 \ + --hash=sha256:3bbb357161e8db43ba7cdcc7e03561eba0c449392f2f27d3566887198fcb4ead \ + --hash=sha256:3fbf9c9d1f3c10c2d59d04aca426dee9ccc6ceb32d255c61e93acc3b4f75fae6 \ --hash=sha256:49b58f1e2c52440abb6f17c28f0335fe6c6d01ad1a7f55b0183b81e4b34d64e6 \ --hash=sha256:49f1ea385c754e54919408a9bb3b5a72b0b755bbe2c916c1d6f70afbec4908a2 \ + --hash=sha256:4ca4a9394b0c771238a4f73590fdbbc4debad85ed0fa63d026ae1b085da7d6e2 \ --hash=sha256:4f8573e3ce9ebcd53fe922f01077a6085ccdfbe5f12fd215883a9d87d7a744fd \ --hash=sha256:572df8be8ffb4599c88cbd6a0726f1f854f4da65d2e3c09f0e2c2283333cd6d4 \ --hash=sha256:60fcdcb2f3876e21146cb4524ef06397d727ca9ad5f020818547e25075fe3cb7 \ + --hash=sha256:6746dbcbeb526eb61330b76b41ff1b4eb848951103a892eeb080dfa2b264667b \ + --hash=sha256:6e9817dbdf5ea76789babd46e457eac5bf14ff566cf85f8addbfdff2d56601ce \ + --hash=sha256:6f307c2c32d764ffc6ff6893b801fad6d4752f3e67966cb8abf1843427c02604 \ --hash=sha256:796633c4cdf0fe2cdced72d8f88f22e73dbcfce83132763162f6d4bff13b820b \ + --hash=sha256:7b8d26e29bceafbdaa8d63bfe7612f23875b5af2cc07e13f809c3ed890bbe1d8 \ + --hash=sha256:84453b69508ec79902f899c5ed9495acb9e2bbe9fda5f1d5d6f19e3c3842e1a7 \ + --hash=sha256:8e109528e6bab044815daebaf71770fbaace3a66ef1c816cb55c875350f78a60 \ + --hash=sha256:8eb5002ca81af00ae69b57540f615b58b8ae922b6d4848176b366a52bd2196e6 \ --hash=sha256:94f0de129916f77b8dc2c7a8eff644cfeddfe59e39c9f55e9f6e17543410281d \ + --hash=sha256:966d020354f465672dc7dd10d3a5c6cd17d7eb48620aa1d265b48a1f78f06898 \ + --hash=sha256:991cc14b39e751122c01f017be6448533989868731cb5eecd1006893d26787c2 \ --hash=sha256:a0d8b11f16a48d60e2015d8213aa0390744cbebb98e58b62b3514dddc656e330 \ + --hash=sha256:a17ff48608634db245e17e8bb00a9558554a49aeb1e4f5fe6cd039af2a10515b \ --hash=sha256:a3893dc2da0a972a8ca5d698c85a9f967559ac5f8ee1797b77408aa8734d073c \ --hash=sha256:a3a9a21312872af8a26950b2c15680335a386a1f56ed03e780653d78b9607e9e \ + --hash=sha256:a43376bd094124ef626bfdd3d4c2c62eacb0b5ddc99776f4a32d4fd16f1f3420 \ --hash=sha256:a7de8a313090dc5c7d7ba4bfe5c3be222528f9a4dba1acc83bddb1157360c4b8 \ + --hash=sha256:a8b450c1e58e5800e5b4691dac412f8d2d65a1dc3298166f91596603a3531e6f \ + --hash=sha256:ac7aaf322be4777765a53bed7264a214dd81b3a1d276b93150515a3c5f75e4b0 \ + --hash=sha256:b222c15a0fc2ce207d1c1a59700b46c8fa6748df1f447ad11e5c870dde0933d9 \ --hash=sha256:c28def70706c2f9ecc752574766e8ae4da9b810ab6676b611166761a78a9f1e1 \ --hash=sha256:c78b7b4d04461855a764cf01bae9a462bb88bc93defcfa11235cbc8fdf3e12c4 \ + --hash=sha256:ca021f9eb2f8345c83fa03e3a04587308afb8df71bd472670b3ece00df58621c \ --hash=sha256:cc26eead4cf51d0b544e31e364dcf000846549c273bd148936fe9d24d29acb92 \ + --hash=sha256:d20fa53ee744502fa4c69818a720b05ca0d37abd055d4f6e66cae155114bc691 \ --hash=sha256:d849b390e07d8d333ce8ecaf91b273c656c598379a19c9acf1318a883f6b391c \ - --hash=sha256:e76f9bcecc52b8ff711239a2f7547d5353df95878ab232f0773c1d95928b92f8 + --hash=sha256:dec241fef3984c0d1edadd1f58708e218d4eae881ceef7bc10cf9964d41b68b9 \ + --hash=sha256:e2e5134decf00e218da62318f3dc5df156231d367871918e91eba95ab0ad43ab \ + --hash=sha256:e76f9bcecc52b8ff711239a2f7547d5353df95878ab232f0773c1d95928b92f8 \ + --hash=sha256:f028e428bddee95cdb86e2470254e95c9af629362488550c200ed4793125a817 \ + --hash=sha256:f5cbb61180a9793d9e12fe115a2310d2600bd449dfb9a01ec5640e21359fa5ea \ + --hash=sha256:fa0762705b933624d59f6823db9ce7ec2e35b3e1e9c319c9db51fbeecfc3e319 \ + --hash=sha256:ffadde149901c8afa138daa38d898264003cfcf1a3336ca5cd964b5af227d867 # via # feast (pyproject.toml) # accelerate @@ -6606,9 +6637,14 @@ torch==2.13.0 \ torchvision==0.28.0 \ --hash=sha256:028a3d481b37d785605620d7cdad897064c5a55bae2aa1f2658766333e291940 \ --hash=sha256:09ce8f56e81f19b9c378ae7bb109f83f6659fd8bc3cd14241a48e4af46e9ed49 \ + --hash=sha256:1aa741ae0eb8668b6287dd667548e2dd10179c828db68bfdee1519763b9c5b99 \ + --hash=sha256:1dad604dfc0177ecebe0891bd9701fe2c62ec3f7819a247be541b3fb6effee99 \ + --hash=sha256:22958193d72444ed7cbcc665ba4821a31e5279f9c4d1ad08520918b30896b78a \ --hash=sha256:2a1ef4b6f4bf5828b48cfad97372c8982db906830884b2868ba5c3df937a7d81 \ + --hash=sha256:2f768c4f6d5adf6d5535061fd69ec44827608bac0e96e12114942a6fdfce1107 \ --hash=sha256:3557cc7b539f46dabcda2b6f2b14017ccbeef024de466d4fc5835fc3f287f769 \ --hash=sha256:36beb0782976906069ca03d4c9aacaf4b6b838b06ed6c20960ea9c51cce7acdd \ + --hash=sha256:3a1a76c8decb1d7bbedd3588bccc90fb269944b7321a773db181735b42115422 \ --hash=sha256:3bd9dba55224a9db4a2d77f6feaa5651770d8c8e86d3d0ddb0fa6bec54c8712b \ --hash=sha256:46f581979c010ad6da6bd85ee602aa707e1ff44312670223b7a0ee517ad06d47 \ --hash=sha256:546fd85345cf8652f6cd099d4f9884b0ca5c2f3fae78689a21dd2f35ea6b622f \ @@ -6616,18 +6652,31 @@ torchvision==0.28.0 \ --hash=sha256:5cf78ebc401ce64ae19b8c55de866bb836797d559a4de9c25ccbe74cfa642d3a \ --hash=sha256:62c7d110f86a039245b587e4fae60278c649f3bd42ff79cfbc1178eca4e72542 \ --hash=sha256:6dfb0f45e2b4ceb4e76f158c3fbb5f44387099f3c466e3423a09ab665a194aba \ + --hash=sha256:7b6667fd0172463be2a271fb0dbd44b31a7891afd549a66208613ce4cdd79f88 \ + --hash=sha256:7d81da2804da52c9788f2d5a8d0aaddcea9fce6eb5d7c6e19a32b40b4ed0b75a \ --hash=sha256:7e80f543b22503d9415e126db5f0ff3917036925e38560ee6b9ae38c571a4002 \ --hash=sha256:7e9dd6f60d6e15f8dc27d4f877fdb6002fc70d70272412135f1c2ff9cfa08d3b \ --hash=sha256:7fad44dc9582570c7d92c4487d36ac46998f40cc39b438e8b8f5111a935ce4e8 \ + --hash=sha256:82dbffb63d61cd43d9c7a311588e665aa2b21173a05f852b4d384d6782fd88ef \ --hash=sha256:83fe6c020866a85acd7d97deccc45ff11d66daf42916d04396a4309c66c0ccb8 \ + --hash=sha256:870d0d42f2eb80f4870cd35e51eea52f596a408a671b28136f06a808846f24c5 \ + --hash=sha256:879ae6d4e2e3651582fb7187eafd535601cb5d019595d47e2c874262a000e88e \ --hash=sha256:87dc16b2df427c1318ad335f1e2be2b3b15b2cf20f7934c83b0505a48425ee5d \ --hash=sha256:89f90e29b0966352811b12589f3a3c61943bf2bb9487b9d7bbec10efb1096bb5 \ + --hash=sha256:8d8b98608779c770ede5e20609772453ebc7487ebb8697445d1856466c542f45 \ --hash=sha256:904cf89af220f8c6b2ed0296bb5065b474ce43b77558e48b2bf9de8b0ba17204 \ --hash=sha256:9a45ea67235d965ef52187130d20002a4de20c54ea3d927a24286961d268dc37 \ --hash=sha256:ad7b3a439265cc3739a4ab5b4c998c0e38ea99c0ee7ca4dea35c5d0b099ec237 \ + --hash=sha256:b545d46f4d2f9d30381281cf22874bfe1d32a8a7b0ee8396fccde89f30c6a9d9 \ --hash=sha256:bb6dd6918460ed89cc7644adcc2402991474d6933cf1ce92b390641cb233fddf \ + --hash=sha256:c6373ec4c2f922e89f45ac91889404d312ba29a31f205b0ad9a725a3894ca246 \ + --hash=sha256:cf5d1c4c355c5b487e7d1c681ef28b9caa2ff0dfa3a32fdcd9e98206a1462bf4 \ + --hash=sha256:d2a0171faa211b506c4dcf3a036942a41077c5d2d3d94883dafbda7b8624a3eb \ --hash=sha256:d483b4aa3f5237569053f749cd1a2b5bb548ca456e40461a5dd087f21149d123 \ - --hash=sha256:e9f54c30cd52e3ef7fd034cc69b7bb7e0964e1c8f8743e018ab92e95b40f9eee + --hash=sha256:d63eae114b4d1fca2b294d300cea3f0d6c71b6d132641e0c4cab1aa06a467b0d \ + --hash=sha256:d88db83abbdfb97199979ec94dd427bc372c1b9ab01f0dbed20af05b0bd644b1 \ + --hash=sha256:e9f54c30cd52e3ef7fd034cc69b7bb7e0964e1c8f8743e018ab92e95b40f9eee \ + --hash=sha256:fc38699d69d11e563a5b1c02f621f639c4caa9e2ffe6b1ddd4aceedffc0d0578 # via # feast (pyproject.toml) # docling-ibm-models diff --git a/sdk/python/tests/unit/infra/scripts/test_cpu_torch_hashes.py b/sdk/python/tests/unit/infra/scripts/test_cpu_torch_hashes.py new file mode 100644 index 00000000000..564cf083f41 --- /dev/null +++ b/sdk/python/tests/unit/infra/scripts/test_cpu_torch_hashes.py @@ -0,0 +1,36 @@ +import runpy +from pathlib import Path + +import pytest + + +def test_cpu_hashes_preserve_pypi_hashes_and_pins() -> None: + script = ( + Path(__file__).resolve().parents[6] / "infra/scripts/add_cpu_torch_hashes.py" + ) + add_hashes = runpy.run_path(str(script))["add_cpu_hashes"] + pypi_hash = "a" * 64 + cpu_hash = "b" * 64 + requirements = ( + f"torch==2.13.0 \\\n --hash=sha256:{pypi_hash}\n" + " # via feast\nnumpy==2.2.0\n" + ) + cpu_requirements = f"torch==2.13.0+cpu \\\n --hash=sha256:{cpu_hash}\n" + expected = ( + f"torch==2.13.0 \\\n --hash=sha256:{pypi_hash} \\\n" + f" --hash=sha256:{cpu_hash}\n" + " # via feast\nnumpy==2.2.0\n" + ) + assert add_hashes(requirements, cpu_requirements) == expected + assert add_hashes(expected, cpu_requirements) == expected + + +def test_cpu_hashes_reject_different_package_version() -> None: + script = ( + Path(__file__).resolve().parents[6] / "infra/scripts/add_cpu_torch_hashes.py" + ) + add_hashes = runpy.run_path(str(script))["add_cpu_hashes"] + requirements = f"torch==2.13.0 \\\n --hash=sha256:{'a' * 64}\n" + cpu_requirements = f"torch==2.12.0+cpu \\\n --hash=sha256:{'b' * 64}\n" + with pytest.raises(ValueError, match="Missing CPU hashes for torch==2.13.0"): + add_hashes(requirements, cpu_requirements) From 3536b45290c1253149041bcce7ef714b40237a79 Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Mon, 14 Sep 2026 09:47:31 -0400 Subject: [PATCH 07/11] test: Reduce FIPS import timeout flakes and capture diagnostics Signed-off-by: Francisco Javier Arceo (cherry picked from commit 05a27c02b3a0efc67d12cf596f6fcf64a9d1249a) --- sdk/python/tests/unit/test_offline_server.py | 34 ++++++++++++++------ 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/sdk/python/tests/unit/test_offline_server.py b/sdk/python/tests/unit/test_offline_server.py index fa1bf85e97e..321b19bb9b7 100644 --- a/sdk/python/tests/unit/test_offline_server.py +++ b/sdk/python/tests/unit/test_offline_server.py @@ -5,6 +5,7 @@ from unittest.mock import MagicMock, mock_open, patch import assertpy +import pytest from feast.infra.offline_stores.remote import ( RemoteOfflineStore, @@ -142,7 +143,7 @@ def test_configure_grpc_fips_noop_without_fips(): assert "GRPC_SSL_CIPHER_SUITES" not in os.environ -def test_module_level_fips_sets_env_before_pyarrow_import(): +def test_module_level_fips_sets_env_before_pyarrow_import() -> None: """GRPC_SSL_CIPHER_SUITES must be set at module load time, before pyarrow.flight (which bundles gRPC) is imported. @@ -150,7 +151,10 @@ def test_module_level_fips_sets_env_before_pyarrow_import(): sys.modules, which lets us verify the true import ordering. """ script = textwrap.dedent("""\ - import io, os, sys + import faulthandler, io, os, sys + + # Capture a stalled import before the parent terminates this process. + faulthandler.dump_traceback_later(120) # Intercept only /proc/sys/crypto/fips_enabled to simulate FIPS _real_open = open @@ -177,18 +181,30 @@ def tracking_import(name, *args, **kwargs): assert "GRPC_SSL_CIPHER_SUITES" in os.environ assert "AES128-GCM-SHA256" in os.environ["GRPC_SSL_CIPHER_SUITES"] finally: + faulthandler.cancel_dump_traceback_later() builtins.__import__ = original_import builtins.open = _real_open """) env = os.environ.copy() env.pop("GRPC_SSL_CIPHER_SUITES", None) - result = subprocess.run( - [sys.executable, "-c", script], - capture_output=True, - text=True, - env=env, - timeout=60, - ) + try: + result = subprocess.run( + [sys.executable, "-c", script], + capture_output=True, + text=True, + env=env, + # Cold imports can be slow on macOS under parallel test load. + timeout=180, + ) + except subprocess.TimeoutExpired as exc: + # TimeoutExpired captures bytes even when subprocess.run uses text=True. + stdout = (exc.stdout or b"").decode(errors="replace") + stderr = (exc.stderr or b"").decode(errors="replace") + pytest.fail( + f"Subprocess timed out after {exc.timeout}s:\n" + f"stdout: {stdout}\nstderr: {stderr}", + pytrace=False, + ) assert result.returncode == 0, ( f"Subprocess failed:\nstdout: {result.stdout}\nstderr: {result.stderr}" ) From 55873756b36d8b73c277c7971959aa8dc3fb9649 Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Mon, 14 Sep 2026 13:05:39 -0400 Subject: [PATCH 08/11] feat: Improve Chronon retrieval reliability and saved datasets Signed-off-by: Francisco Javier Arceo --- docs/reference/offline-stores/chronon.md | 31 ++- docs/reference/online-stores/chronon.md | 5 +- sdk/python/feast/infra/chronon_provider.py | 31 +++ .../contrib/chronon_offline_store/chronon.py | 109 +++++++-- .../chronon_online_store/chronon.py | 13 +- .../test_chronon_retrieval.py | 227 +++++++++++++++++- .../test_chronon_online_store.py | 122 +++++++++- 7 files changed, 510 insertions(+), 28 deletions(-) diff --git a/docs/reference/offline-stores/chronon.md b/docs/reference/offline-stores/chronon.md index 1e8b73aabb7..770d16be66c 100644 --- a/docs/reference/offline-stores/chronon.md +++ b/docs/reference/offline-stores/chronon.md @@ -52,8 +52,35 @@ driver_stats = FeatureView( `get_historical_features` performs point-in-time joins against Chronon's materialized Parquet data. For each entity row, Feast selects the latest Chronon row with an event timestamp at or before the entity timestamp. If `created_timestamp_column` is configured and duplicate event timestamps exist, the latest created row wins. +Reads select only the required feature, entity-key, event-time, and (when needed) created-time columns from Parquet, translating field mappings to physical column names before loading. Joins still execute locally in pandas; column selection reduces I/O and memory use but does not provide distributed execution. + +Python on-demand feature views can transform the retrieved features locally through Feast's standard retrieval job. Put required request-time inputs in the pandas `entity_df`. `to_df()`, `to_arrow()`, and saved datasets include the requested transformed outputs. Time-range retrieval without an `entity_df` cannot supply request-time inputs. + This is intended for training and validation workflows that want Feast's registry and retrieval APIs while using Chronon as the feature computation engine. +## Save retrieval results + +Use `provider: chronon` and `SavedDatasetFileStorage` to persist a retrieval result as Parquet and load it again through Feast: + +```python +from feast.infra.offline_stores.file_source import SavedDatasetFileStorage + +job = store.get_historical_features( + entity_df=entity_df, + features=["driver_stats:rating"], +) +training = store.create_saved_dataset( + from_=job, + name="training_v1", + storage=SavedDatasetFileStorage(path="data/training_v1.parquet"), +) +training_df = store.get_saved_dataset("training_v1").to_df() +``` + +Relative paths resolve against the feature repository. File storage can also use a Parquet directory or supported PyArrow filesystem URI, including S3 with the existing file-storage credentials/endpoint configuration. Existing destinations are rejected unless `allow_overwrite=True`; overwriting a directory replaces its contents. Use a dedicated output location. Writes are synchronous and are not an atomic publication mechanism. + +The saved result retains request columns, custom entity timestamp names, full feature names, and already-computed on-demand features. This saves training results; it does not write feature values into Chronon's computation or online storage. + ## Configuration reference | Parameter | Required | Default | Description | @@ -85,9 +112,9 @@ Below is a matrix indicating which functionality is supported by `ChrononRetriev | export to data lake (S3, GCS, etc.) | no | | export to data warehouse | no | | export as Spark dataframe | no | -| local execution of Python-based on-demand transforms | no | +| local execution of Python-based on-demand transforms | yes | | remote execution of Python-based on-demand transforms | no | -| persist results in the offline store | no | +| persist results in the offline store | yes (Parquet saved datasets) | | preview the query plan before execution | no | | read partitioned data | yes | diff --git a/docs/reference/online-stores/chronon.md b/docs/reference/online-stores/chronon.md index 245f35d94bb..5c4be7790bd 100644 --- a/docs/reference/online-stores/chronon.md +++ b/docs/reference/online-stores/chronon.md @@ -48,7 +48,9 @@ Feast builds Chronon URLs from the source metadata: | `chronon_join` | `/v1/features/join/{quoted_chronon_join}` | | `chronon_group_by` | `/v1/features/groupby/{quoted_chronon_group_by}` | -The request body is a list of entity rows. Chronon responses are expected to be JSON objects with a `results` list whose length matches the number of requested entity keys. Rows with non-success statuses are returned as missing feature rows. +The request body is a list of entity rows. Chronon responses are expected to be JSON objects with a `results` list whose length matches the number of requested entity keys. Successful rows preserve missing/null feature values. A `Failure` row (or an unknown/missing status) raises `RuntimeError`, even when the HTTP status is 200, so a backend error is not silently treated as an unknown entity. A failure in any row fails the entire retrieval call. HTTP errors also raise. + +Retries are opt-in through `connection_retries` (0–5, default 0). This uses Feast's shared HTTP session manager, including retries for the read-only POST request on connection failures, read timeouts, and HTTP 429, 500, 502, 503, and 504. HTTP 400 and per-row Chronon failures are not retried. There are at most `1 + connection_retries` attempts, with the session manager's exponential backoff and `Retry-After` handling. `timeout` applies to each attempt's connection/read timeout, not a total wall-clock deadline; account for additional attempts and backoff in your inference latency budget. ## Local service testing @@ -73,6 +75,7 @@ CHRONON_PREFLIGHT_ONLY=1 CHRONON_REPO=/path/to/chronon infra/scripts/chronon/sta | `type` | yes | `chronon` | Must be set to `chronon`. | | `path` | no | `http://localhost:8080` | Chronon online service base URL. | | `timeout` | no | `30` | HTTP request timeout in seconds. | +| `connection_retries` | no | `0` | Additional HTTP attempts, an integer from 0 to 5. | | `verify_ssl` | no | `true` | Whether TLS certificates are verified for HTTPS requests. | ## Functionality Matrix diff --git a/sdk/python/feast/infra/chronon_provider.py b/sdk/python/feast/infra/chronon_provider.py index 6df8881e387..b82958e72a3 100644 --- a/sdk/python/feast/infra/chronon_provider.py +++ b/sdk/python/feast/infra/chronon_provider.py @@ -1,5 +1,36 @@ +import pandas as pd + +from feast.infra.offline_stores.contrib.chronon_offline_store.chronon import ( + ChrononRetrievalJob, +) +from feast.infra.offline_stores.file_source import FileSource, SavedDatasetFileStorage +from feast.infra.offline_stores.offline_store import RetrievalJob from feast.infra.passthrough_provider import PassthroughProvider +from feast.repo_config import RepoConfig +from feast.saved_dataset import SavedDataset class ChrononProvider(PassthroughProvider): """Optional provider wrapper for Chronon-backed Feast configurations.""" + + def retrieve_saved_dataset( + self, config: RepoConfig, dataset: SavedDataset + ) -> RetrievalJob: + if not isinstance(dataset.storage, SavedDatasetFileStorage): + raise ValueError("Chronon saved datasets require file storage.") + options = dataset.storage.file_options + uri = FileSource.get_uri_for_file_path( + repo_path=config.repo_path, uri=options.uri + ) + filesystem, path = FileSource.create_filesystem_and_path( + str(uri), options.s3_endpoint_override + ) + + def evaluate() -> pd.DataFrame: + # Read the saved result as-is: preserve request columns, custom time + # column names, and already-computed on-demand features. + return pd.read_parquet(path, filesystem=filesystem) + + return ChrononRetrievalJob( + evaluate, dataset.full_feature_names, repo_path=str(config.repo_path) + ) diff --git a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py index 5c2acfb35c4..9b52f3d9296 100644 --- a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py +++ b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py @@ -1,16 +1,21 @@ +import posixpath from datetime import datetime from pathlib import Path from typing import Any, Callable, List, Literal, Optional, Union import pandas as pd import pyarrow as pa +import pyarrow.fs as pafs +import pyarrow.parquet as pq from pydantic import StrictStr from feast import utils +from feast.data_format import ParquetFormat from feast.data_source import DataSource +from feast.errors import SavedDatasetLocationAlreadyExists from feast.feature_logging import LoggingConfig, LoggingSource from feast.feature_view import FeatureView -from feast.infra.offline_stores.file_source import FileSource +from feast.infra.offline_stores.file_source import FileSource, SavedDatasetFileStorage from feast.infra.offline_stores.offline_store import ( OfflineStore, RetrievalJob, @@ -39,10 +44,14 @@ def __init__( evaluation_function: Callable[[], pd.DataFrame], full_feature_names: bool, metadata: Optional[RetrievalMetadata] = None, - ): + repo_path: str = ".", + on_demand_feature_views: Optional[List[OnDemandFeatureView]] = None, + ) -> None: self.evaluation_function = evaluation_function self._full_feature_names = full_feature_names self._metadata = metadata + self.repo_path = repo_path + self._on_demand_feature_views = on_demand_feature_views or [] @property def full_feature_names(self) -> bool: @@ -50,7 +59,7 @@ def full_feature_names(self) -> bool: @property def on_demand_feature_views(self) -> List[OnDemandFeatureView]: - return [] + return self._on_demand_feature_views def _to_df_internal(self, timeout: Optional[int] = None) -> pd.DataFrame: return self.evaluation_function().reset_index(drop=True) @@ -63,10 +72,34 @@ def persist( storage: SavedDatasetStorage, allow_overwrite: bool = False, timeout: Optional[int] = None, - ): - raise NotImplementedError( - "ChrononRetrievalJob does not currently support persisted saved datasets." + ) -> None: + if not isinstance(storage, SavedDatasetFileStorage) or not isinstance( + storage.file_options.file_format, ParquetFormat + ): + raise ValueError("Chronon retrieval results require Parquet file storage.") + uri = FileSource.get_uri_for_file_path( + repo_path=Path(self.repo_path), uri=storage.file_options.uri ) + filesystem, path = FileSource.create_filesystem_and_path( + str(uri), storage.file_options.s3_endpoint_override + ) + if filesystem is None: + filesystem, path = pafs.FileSystem.from_uri(str(uri)) + info = filesystem.get_file_info(path) + if info.type != pafs.FileType.NotFound and not allow_overwrite: + raise SavedDatasetLocationAlreadyExists(location=str(uri)) + # Evaluate before replacing an existing result, including ODFV transforms. + table = self.to_arrow(timeout=timeout) + if path.endswith(".parquet"): + filesystem.create_dir(posixpath.dirname(path), recursive=True) + pq.write_table(table, path, filesystem=filesystem) + else: + if info.type == pafs.FileType.Directory: + filesystem.delete_dir_contents(path) + filesystem.create_dir(path, recursive=True) + pq.write_table( + table, posixpath.join(path, "part-0.parquet"), filesystem=filesystem + ) @property def metadata(self) -> Optional[RetrievalMetadata]: @@ -83,13 +116,18 @@ def _get_chronon_source(feature_view: FeatureView): def _load_materialized_dataframe( - config: RepoConfig, feature_view: FeatureView + config: RepoConfig, feature_view: FeatureView, columns: List[str] ) -> pd.DataFrame: source = _get_chronon_source(feature_view) resolved_path = FileSource.get_uri_for_file_path( repo_path=config.repo_path, uri=source.materialization_path ) - dataframe = pd.read_parquet(resolved_path) + # Projection uses physical Parquet names; mapping happens after the read. + reverse_mapping = {value: key for key, value in source.field_mapping.items()} + physical_columns = list( + dict.fromkeys(reverse_mapping.get(col, col) for col in columns) + ) + dataframe = pd.read_parquet(resolved_path, columns=physical_columns) if source.field_mapping: dataframe = dataframe.rename(columns=source.field_mapping) return utils.make_df_tzaware(dataframe) @@ -135,9 +173,11 @@ def get_historical_features( registry.list_on_demand_feature_views(project), ) ) - if requested_odfvs: + if entity_df is None and any( + odfv.get_request_data_schema() for odfv in requested_odfvs + ): raise ValueError( - "ChrononOfflineStore does not support on-demand feature views." + "On-demand request data must be supplied in a pandas entity_df." ) if entity_df is not None and not isinstance(entity_df, pd.DataFrame): raise ValueError( @@ -165,8 +205,16 @@ def get_historical_features( def evaluate_non_entity_retrieval() -> pd.DataFrame: feature_view, selected_features = next(iter(requested_features.items())) - dataframe = _load_materialized_dataframe(config, feature_view) timestamp_col = _get_required_timestamp_field(feature_view) + dataframe = _load_materialized_dataframe( + config, + feature_view, + [ + *(entity.name for entity in feature_view.entity_columns), + timestamp_col, + *selected_features, + ], + ) start_date = kwargs.get("start_date") end_date = kwargs.get("end_date") if start_date is not None: @@ -197,6 +245,8 @@ def evaluate_non_entity_retrieval() -> pd.DataFrame: evaluation_function=evaluate_non_entity_retrieval, full_feature_names=full_feature_names, metadata=metadata, + repo_path=str(config.repo_path), + on_demand_feature_views=list(requested_odfvs), ) entity_df = utils.make_df_tzaware(entity_df) @@ -214,7 +264,6 @@ def evaluate_historical_retrieval() -> pd.DataFrame: result = entity_df.copy() for feature_view, selected_features in requested_features.items(): source = _get_chronon_source(feature_view) - source_df = _load_materialized_dataframe(config, feature_view) timestamp_col = _get_required_timestamp_field(feature_view) created_col = source.created_timestamp_column left_keys = [] @@ -227,6 +276,16 @@ def evaluate_historical_retrieval() -> pd.DataFrame: ) right_keys.append(entity_column.name) + source_df = _load_materialized_dataframe( + config, + feature_view, + [ + *right_keys, + timestamp_col, + *([created_col] if created_col else []), + *selected_features, + ], + ) sort_columns = right_keys + [timestamp_col] if created_col and created_col in source_df.columns: sort_columns.append(created_col) @@ -305,6 +364,8 @@ def evaluate_historical_retrieval() -> pd.DataFrame: evaluation_function=evaluate_historical_retrieval, full_feature_names=full_feature_names, metadata=metadata, + repo_path=str(config.repo_path), + on_demand_feature_views=list(requested_odfvs), ) @staticmethod @@ -328,7 +389,16 @@ def evaluate_pull_latest() -> pd.DataFrame: schema=[], source=data_source, ) - dataframe = _load_materialized_dataframe(config, feature_view) + dataframe = _load_materialized_dataframe( + config, + feature_view, + [ + *join_key_columns, + timestamp_field, + *([created_timestamp_column] if created_timestamp_column else []), + *feature_name_columns, + ], + ) dataframe = dataframe[ (dataframe[timestamp_field] >= utils.make_tzaware(start_date)) & (dataframe[timestamp_field] <= utils.make_tzaware(end_date)) @@ -349,6 +419,7 @@ def evaluate_pull_latest() -> pd.DataFrame: return ChrononRetrievalJob( evaluation_function=evaluate_pull_latest, full_feature_names=False, + repo_path=str(config.repo_path), ) @staticmethod @@ -372,7 +443,16 @@ def evaluate_pull_all() -> pd.DataFrame: schema=[], source=data_source, ) - dataframe = _load_materialized_dataframe(config, feature_view) + dataframe = _load_materialized_dataframe( + config, + feature_view, + [ + *join_key_columns, + timestamp_field, + *([created_timestamp_column] if created_timestamp_column else []), + *feature_name_columns, + ], + ) if start_date is not None: dataframe = dataframe[ dataframe[timestamp_field] >= utils.make_tzaware(start_date) @@ -387,6 +467,7 @@ def evaluate_pull_all() -> pd.DataFrame: return ChrononRetrievalJob( evaluation_function=evaluate_pull_all, full_feature_names=False, + repo_path=str(config.repo_path), ) @staticmethod diff --git a/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py b/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py index 52b39b04694..3cfc84795fe 100644 --- a/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py +++ b/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py @@ -2,7 +2,7 @@ from typing import Any, Callable, Dict, List, Literal, Optional, Tuple from urllib.parse import quote -from pydantic import StrictInt, StrictStr +from pydantic import Field, StrictInt, StrictStr from feast.data_source import DataSource from feast.feature_view import FeatureView @@ -23,6 +23,7 @@ class ChrononOnlineStoreConfig(FeastConfigBaseModel): path: StrictStr = "http://localhost:8080" timeout: StrictInt = 30 verify_ssl: bool = True + connection_retries: StrictInt = Field(default=0, ge=0, le=5) class ChrononOnlineStore(OnlineStore): @@ -119,7 +120,7 @@ def online_read( ] session = HttpSessionManager.get_session( config.auth_config, - max_retries=0, + max_retries=config.online_store.connection_retries, ) response = session.post( url, @@ -141,12 +142,14 @@ def online_read( ) output: List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]] = [] - for row in results: + for row_index, row in enumerate(results): if not isinstance(row, dict): raise RuntimeError("Chronon response rows must be JSON objects.") if row.get("status") != "Success": - output.append((None, None)) - continue + raise RuntimeError( + f"Chronon failed to retrieve row {row_index}: " + f"unexpected status {row.get('status')!r}." + ) features = row.get("features", {}) if not isinstance(features, dict): raise RuntimeError( diff --git a/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py b/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py index 167229e23ac..3cbf21371fe 100644 --- a/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py +++ b/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py @@ -1,11 +1,12 @@ from datetime import timedelta from pathlib import Path +from typing import Any import pandas as pd import pytest from feast import ChrononSource, Entity, FeatureStore, FeatureView, Field, RepoConfig -from feast.types import Float32 +from feast.types import Float32, Float64, Int64 def _store(tmp_path: Path, ttl: timedelta, partitioned: bool = False) -> FeatureStore: @@ -90,3 +91,227 @@ def test_historical_retrieval_infers_partitioned_entity(tmp_path: Path) -> None: features=["profile:feature_a"], ).to_df() assert result["feature_a"].tolist() == [4.0, 2.0] + + +def _entities() -> pd.DataFrame: + return pd.DataFrame( + { + "user_id": [2, 1], + "event_timestamp": pd.to_datetime(["2024-01-02", "2024-01-02"], utc=True), + } + ) + + +@pytest.mark.parametrize("destination", ["saved/data.parquet", "saved/dataset"]) +@pytest.mark.parametrize("timestamp", ["event_timestamp", "request_time"]) +def test_saved_dataset_round_trip( + tmp_path: Path, destination: str, timestamp: str +) -> None: + from feast.errors import SavedDatasetLocationAlreadyExists + from feast.infra.offline_stores.file_source import SavedDatasetFileStorage + + store = _store(tmp_path, timedelta(days=1)) + job = store.get_historical_features( + entity_df=_entities().rename(columns={"event_timestamp": timestamp}), + features=["profile:feature_a"], + full_feature_names=True, + ) + storage = SavedDatasetFileStorage(path=destination) + dataset = store.create_saved_dataset(from_=job, name="training", storage=storage) + pd.testing.assert_frame_equal(dataset.to_df(), job.to_df()) + pd.testing.assert_frame_equal( + store.get_saved_dataset("training").to_df(), job.to_df() + ) + with pytest.raises(SavedDatasetLocationAlreadyExists): + job.persist(storage) + if not destination.endswith(".parquet"): + pd.DataFrame({"stale": [1]}).to_parquet(tmp_path / destination / "old.parquet") + smaller = store.get_historical_features( + entity_df=_entities().iloc[:1].rename(columns={"event_timestamp": timestamp}), + features=["profile:feature_a"], + full_feature_names=True, + ) + smaller.persist(storage, allow_overwrite=True) + pd.testing.assert_frame_equal( + pd.read_parquet(tmp_path / destination), smaller.to_df() + ) + + +@pytest.mark.parametrize("partitioned", [False, True]) +def test_projection_reads_only_required_physical_columns( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch, partitioned: bool +) -> None: + store = _store(tmp_path, timedelta(days=1)) + path = tmp_path / "mapped" + pd.DataFrame( + { + "raw_user": [1, 1], + "raw_time": pd.to_datetime(["2024-01-01"] * 2, utc=True), + "raw_created": pd.to_datetime(["2024-01-01", "2024-01-02"], utc=True), + "raw_value": [2.0, 3.0], + "unused": ["large payload"] * 2, + } + ).to_parquet(path, partition_cols=["raw_user"] if partitioned else None) + user = store.get_entity("user") + view = FeatureView( + name="mapped", + entities=[user], + schema=[Field(name="user_id", dtype=Int64), Field(name="value", dtype=Float32)], + source=ChrononSource( + materialization_path=str(path), + timestamp_field="event_timestamp", + created_timestamp_column="created", + field_mapping={ + "raw_user": "user_id", + "raw_time": "event_timestamp", + "raw_created": "created", + "raw_value": "value", + }, + ), + ) + store.apply(view) + original = pd.read_parquet + reads = [] + + def read(*args: Any, **kwargs: Any) -> pd.DataFrame: + reads.append(kwargs.get("columns")) + return original(*args, **kwargs) + + monkeypatch.setattr(pd, "read_parquet", read) + result = store.get_historical_features( + entity_df=_entities(), features=["mapped:value"] + ).to_df() + assert result["value"].iloc[1] == 3.0 + assert reads == [["raw_user", "raw_time", "raw_created", "raw_value"]] + + +@pytest.mark.parametrize("full_names", [False, True]) +def test_on_demand_features_and_persisted_results( + tmp_path: Path, full_names: bool +) -> None: + from feast import RequestSource + from feast.errors import RequestDataNotFoundInEntityDfException + from feast.infra.offline_stores.file_source import SavedDatasetFileStorage + from feast.on_demand_feature_view import on_demand_feature_view + + store = _store(tmp_path, timedelta(days=1)) + request = RequestSource( + name="checkout", schema=[Field(name="amount", dtype=Float32)] + ) + + @on_demand_feature_view( + sources=[store.get_feature_view("profile"), request], + schema=[ + Field(name="risk", dtype=Float64), + Field(name="unused_risk", dtype=Float64), + ], + mode="pandas", + ) + def checkout_risk(inputs: pd.DataFrame) -> pd.DataFrame: + return pd.DataFrame( + { + "risk": inputs["feature_a"] + inputs["amount"], + "unused_risk": inputs["feature_a"] * 2, + } + ) + + store.apply(checkout_risk) + entities = _entities().assign(amount=[10.0, 20.0]) + job = store.get_historical_features( + entity_df=entities, + features=["checkout_risk:risk"], + full_feature_names=full_names, + ) + result = job.to_df() + name = "checkout_risk__risk" if full_names else "risk" + assert result[name].tolist() == [14.0, 22.0] + assert not any("unused_risk" in col for col in result.columns) + pd.testing.assert_frame_equal(job.to_arrow().to_pandas(), result) + dataset = store.create_saved_dataset( + from_=job, + name="risk_training", + storage=SavedDatasetFileStorage(path="risk.parquet"), + ) + pd.testing.assert_frame_equal(dataset.to_df(), result) + with pytest.raises(RequestDataNotFoundInEntityDfException, match="amount"): + store.get_historical_features( + entity_df=_entities(), features=["checkout_risk:risk"] + ) + + +@pytest.mark.parametrize("full_names", [False, True]) +def test_empty_saved_dataset(tmp_path: Path, full_names: bool) -> None: + from feast.infra.offline_stores.file_source import SavedDatasetFileStorage + + store = _store(tmp_path, timedelta(days=1)) + job = store.get_historical_features( + entity_df=_entities().iloc[:0], + features=["profile:feature_a"], + full_feature_names=full_names, + ) + dataset = store.create_saved_dataset( + from_=job, + name="empty_training", + storage=SavedDatasetFileStorage(path="empty.parquet"), + ) + pd.testing.assert_frame_equal(dataset.to_df(), job.to_df()) + + +def test_saved_dataset_checks_destination_filesystem( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + import pyarrow.fs as pafs + + from feast.errors import SavedDatasetLocationAlreadyExists + from feast.infra.offline_stores.file_source import ( + FileSource, + SavedDatasetFileStorage, + ) + + store = _store(tmp_path, timedelta(days=1)) + filesystem = pafs.SubTreeFileSystem(str(tmp_path), pafs.LocalFileSystem()) + + def resolve(uri: str, endpoint: str) -> tuple[Any, str]: + assert uri == "s3://bucket/saved.parquet" + return filesystem, "bucket/saved.parquet" + + monkeypatch.setattr(FileSource, "create_filesystem_and_path", resolve) + job = store.get_historical_features( + entity_df=_entities(), features=["profile:feature_a"] + ) + storage = SavedDatasetFileStorage(path="s3://bucket/saved.parquet") + dataset = store.create_saved_dataset( + from_=job, name="remote_training", storage=storage + ) + pd.testing.assert_frame_equal(dataset.to_df(), job.to_df()) + with pytest.raises(SavedDatasetLocationAlreadyExists): + job.persist(storage) + + +def test_request_only_on_demand_features(tmp_path: Path) -> None: + from feast import RequestSource + from feast.on_demand_feature_view import on_demand_feature_view + + store = _store(tmp_path, timedelta(days=1)) + request = RequestSource( + name="checkout", schema=[Field(name="amount", dtype=Float64)] + ) + + @on_demand_feature_view( + sources=[request], schema=[Field(name="doubled", dtype=Float64)], mode="pandas" + ) + def request_risk(inputs: pd.DataFrame) -> pd.DataFrame: + return pd.DataFrame({"doubled": inputs["amount"] * 2}) + + store.apply(request_risk) + result = store.get_historical_features( + entity_df=_entities().assign(amount=[10.0, 20.0]), + features=["request_risk:doubled"], + ).to_df() + assert result["doubled"].tolist() == [20.0, 40.0] + with pytest.raises(ValueError, match="request data.*entity_df"): + store.get_historical_features( + features=["request_risk:doubled"], + start_date=pd.Timestamp("2024-01-01", tz="UTC"), + end_date=pd.Timestamp("2024-01-02", tz="UTC"), + ) diff --git a/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py b/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py index e87ca8bfdb5..264b49982b4 100644 --- a/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py +++ b/sdk/python/tests/unit/infra/online_stores/chronon_online_store/test_chronon_online_store.py @@ -13,6 +13,8 @@ ChrononOnlineStoreConfig, ) from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto +from feast.protos.feast.types.Value_pb2 import Int64List +from feast.protos.feast.types.Value_pb2 import Map as MapProto from feast.protos.feast.types.Value_pb2 import Value as ValueProto from feast.repo_config import RegistryConfig, RepoConfig from feast.types import Array, FeastType, Float32, Int32, Int64, Map @@ -81,7 +83,7 @@ def _entity_keys() -> list[EntityKeyProto]: ] -def test_chronon_online_store_maps_success_and_failure(monkeypatch, tmp_path: Path): +def test_chronon_online_store_maps_success_and_missing(monkeypatch, tmp_path: Path): data_path = _write_chronon_parquet(tmp_path) config = _repo_config(tmp_path) @@ -102,7 +104,7 @@ def post(self, url, json, timeout, verify): { "results": [ {"status": "Success", "features": {"feature_a": 0.5}}, - {"status": "Failure", "error": "boom"}, + {"status": "Success", "features": {"feature_a": None}}, ] } ) @@ -123,7 +125,7 @@ def post(self, url, json, timeout, verify): assert captured["json"] == [{"user_id": 1}, {"user_id": 2}] assert rows[0][1] is not None assert rows[0][1]["feature_a"] == ValueProto(float_val=0.5) - assert rows[1] == (None, None) + assert rows[1] == (None, {"feature_a": ValueProto()}) def test_chronon_online_store_builds_group_by_url(monkeypatch, tmp_path: Path): @@ -296,8 +298,8 @@ def post(self, url, json, timeout, verify): [ (Float32, 0.5, ValueProto(float_val=0.5)), (Int32, 3, ValueProto(int32_val=3)), - (Array(Int64), [], ValueProto(int64_list_val={"val": []})), - (Map, {}, ValueProto(map_val={})), + (Array(Int64), [], ValueProto(int64_list_val=Int64List())), + (Map, {}, ValueProto(map_val=MapProto())), (Float32, None, ValueProto()), ], ) @@ -368,3 +370,113 @@ def post(self, url: str, json: Any, **kwargs: Any) -> _Response: features=["profile:renamed"], entity_rows=[{"customer_id": 1}] ).to_dict() assert result == {"customer_id": [1], "renamed": [2.0]} + + +@pytest.mark.parametrize("status", ["Failure", "Unexpected", None]) +def test_online_read_raises_on_unsuccessful_rows( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path, status: Any +) -> None: + source = ChrononSource( + materialization_path=str(_write_chronon_parquet(tmp_path)), + chronon_join="team/training_set.v1", + timestamp_field="event_timestamp", + ) + + class Session: + def post(self, *args: Any, **kwargs: Any) -> _Response: + return _Response( + {"results": [{"status": status, "error": "backend unavailable"}]} + ) + + monkeypatch.setattr( + "feast.infra.online_stores.chronon_online_store.chronon.HttpSessionManager.get_session", + lambda *args, **kwargs: Session(), + ) + with pytest.raises(RuntimeError, match="Chronon.*row 0"): + ChrononOnlineStore().online_read( + _repo_config(tmp_path), + _feature_view(source), + _entity_keys()[:1], + ["feature_a"], + ) + + +@pytest.mark.parametrize("retries", [-1, 6, True, 1.5]) +def test_retry_count_is_bounded(retries: Any) -> None: + from pydantic import ValidationError + + with pytest.raises(ValidationError): + ChrononOnlineStoreConfig(connection_retries=retries) + + +@pytest.mark.parametrize( + "retries,status,expected_calls,success", + [ + (0, 503, 1, False), + (1, 503, 2, True), + (1, 400, 1, False), + (1, 429, 2, True), + (1, 502, 2, True), + (1, 504, 2, True), + (1, 500, 2, True), + (2, 503, 3, False), + ], +) +def test_online_read_http_retry_policy( + tmp_path: Path, retries: int, status: int, expected_calls: int, success: bool +) -> None: + import json + import threading + from http.server import BaseHTTPRequestHandler, HTTPServer + + import requests + + from feast.permissions.client.http_auth_requests_wrapper import HttpSessionManager + + calls = [] + + class Handler(BaseHTTPRequestHandler): + def do_POST(self) -> None: + calls.append( + json.loads(self.rfile.read(int(self.headers["Content-Length"]))) + ) + code = 200 if success and len(calls) > 1 else status + body = json.dumps( + {"results": [{"status": "Success", "features": {"feature_a": 2.0}}]} + ).encode() + self.send_response(code) + self.send_header("Content-Length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + def log_message(self, *args: Any) -> None: + pass + + server = HTTPServer(("127.0.0.1", 0), Handler) + thread = threading.Thread(target=server.serve_forever, daemon=True) + thread.start() + try: + config = _repo_config(tmp_path) + config.online_store.path = f"http://127.0.0.1:{server.server_port}" + config.online_store.connection_retries = retries + source = ChrononSource( + materialization_path="unused.parquet", + chronon_join="team/join", + timestamp_field="event_timestamp", + ) + if success: + rows = ChrononOnlineStore().online_read( + config, _feature_view(source), _entity_keys()[:1], ["feature_a"] + ) + assert rows == [(None, {"feature_a": ValueProto(float_val=2.0)})] + else: + with pytest.raises(requests.RequestException): + ChrononOnlineStore().online_read( + config, _feature_view(source), _entity_keys()[:1], ["feature_a"] + ) + assert calls == [[{"user_id": 1}]] * expected_calls + finally: + HttpSessionManager.close_session() + server.shutdown() + server.server_close() + thread.join(timeout=5) From ef63f93d65d59f87a0dcf353a522c73c99e550e1 Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Mon, 5 Oct 2026 10:42:27 -0400 Subject: [PATCH 09/11] fix: Preserve Chronon retrieval inputs and run complete CI coverage Signed-off-by: Francisco Javier Arceo --- .../pr_chronon_integration_tests.yml | 37 +++++++------ .../contrib/chronon_offline_store/chronon.py | 22 +++++--- .../test_chronon_retrieval.py | 52 +++++++++++++++++++ 3 files changed, 90 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pr_chronon_integration_tests.yml b/.github/workflows/pr_chronon_integration_tests.yml index 6e8019a0860..a3d7de8aed3 100644 --- a/.github/workflows/pr_chronon_integration_tests.yml +++ b/.github/workflows/pr_chronon_integration_tests.yml @@ -12,6 +12,9 @@ on: - "sdk/python/feast/infra/chronon_provider.py" - "sdk/python/tests/unit/infra/online_stores/chronon_online_store/**" - "sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/**" + - "sdk/python/tests/unit/examples/test_chronon_demo.py" + - "sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py" + - "examples/chronon/**" - "sdk/python/tests/integration/online_store/test_chronon_online_store.py" - "sdk/python/tests/integration/online_store/test_chronon_online_store_real_service.py" - "sdk/python/tests/integration/offline_store/test_chronon_offline_store.py" @@ -29,7 +32,8 @@ jobs: ((github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'lgtm' || github.event.label.name == 'ok-to-test')) || (github.event.action != 'labeled' && (contains(github.event.pull_request.labels.*.name, 'ok-to-test') || contains(github.event.pull_request.labels.*.name, 'approved') || contains(github.event.pull_request.labels.*.name, 'lgtm')))) && github.event.pull_request.base.repo.full_name == 'feast-dev/feast' - runs-on: ubuntu-latest + # The Chronon quickstart image is published for ARM64 only. + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v4 with: @@ -40,7 +44,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.11" - architecture: x64 + architecture: arm64 - name: Install uv uses: astral-sh/setup-uv@v5 with: @@ -50,8 +54,23 @@ jobs: with: distribution: temurin java-version: "8" + - name: Setup sbt + uses: sbt/setup-sbt@v1 - name: Install dependencies run: make install-python-dependencies-ci + - name: Run Chronon unit tests + run: | + uv run pytest -c sdk/python/pytest.ini \ + sdk/python/tests/unit/infra/online_stores/chronon_online_store \ + sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store \ + sdk/python/tests/unit/examples/test_chronon_demo.py \ + sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py + - name: Run Chronon stub integration tests + run: | + uv run pytest -c sdk/python/pytest.ini \ + sdk/python/tests/integration/online_store/test_chronon_online_store.py \ + sdk/python/tests/integration/offline_store/test_chronon_offline_store.py \ + --integration - name: Checkout Chronon env: CHRONON_REPO: ${{ github.workspace }}/.chronon @@ -78,11 +97,7 @@ jobs: pkg-config \ python3-pip \ python3-venv - echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list - curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x99E82A75642AC823" | sudo apt-key add - - sudo apt-get update - sudo apt-get install -y sbt - curl -sSL "http://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.tar.gz" -o /tmp/thrift.tar.gz + curl -fsSL "https://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.tar.gz" -o /tmp/thrift.tar.gz sudo rm -rf /usr/src/thrift sudo mkdir -p /usr/src/thrift sudo tar zxf /tmp/thrift.tar.gz -C /usr/src/thrift --strip-components=1 @@ -100,14 +115,6 @@ jobs: sbt assembly cd "${CHRONON_REPO}" sbt "project service" assembly - - name: Run Chronon unit and stub integration tests - run: | - uv run pytest -c sdk/python/pytest.ini \ - sdk/python/tests/unit/infra/online_stores/chronon_online_store \ - sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store \ - sdk/python/tests/integration/online_store/test_chronon_online_store.py \ - sdk/python/tests/integration/offline_store/test_chronon_offline_store.py \ - --integration - name: Start live Chronon service env: CHRONON_REPO: ${{ github.workspace }}/.chronon diff --git a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py index 9b52f3d9296..be06dea14ee 100644 --- a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py +++ b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py @@ -308,6 +308,8 @@ def evaluate_historical_retrieval() -> pd.DataFrame: ) merge_frame = merge_frame.rename(columns=rename_map) row_id_col = "__chronon_row_id" + while row_id_col in result.columns or row_id_col in merge_frame.columns: + row_id_col += "_" result = result.assign(**{row_id_col: range(len(result))}) if result.empty: for feature in selected_features: @@ -322,18 +324,26 @@ def evaluate_historical_retrieval() -> pd.DataFrame: result[output_column] = pd.Series(dtype=dtype) result = result.drop(columns=[row_id_col]) continue + right_frames = ( + merge_frame.groupby( + left_keys, sort=False, dropna=False, observed=True + ) + if left_keys + else [((), merge_frame)] + ) right_groups = { key if isinstance(key, tuple) else (key,): group.drop( columns=left_keys, errors="ignore" ) - for key, group in merge_frame.groupby( - left_keys, sort=False, dropna=False - ) + for key, group in right_frames } joined_frames = [] - for key, left_group in result.groupby( - left_keys, sort=False, dropna=False - ): + left_frames = ( + result.groupby(left_keys, sort=False, dropna=False, observed=True) + if left_keys + else [((), result)] + ) + for key, left_group in left_frames: group_key = key if isinstance(key, tuple) else (key,) right_group = right_groups.get(group_key, merge_frame.iloc[0:0]) right_group = right_group.drop(columns=left_keys, errors="ignore") diff --git a/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py b/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py index 3cbf21371fe..7dd1ff9b941 100644 --- a/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py +++ b/sdk/python/tests/unit/infra/offline_stores/contrib/chronon_offline_store/test_chronon_retrieval.py @@ -76,6 +76,58 @@ def test_historical_retrieval_infers_entity_timestamp(tmp_path: Path) -> None: pd.testing.assert_series_equal(result["request_time"], entity_df["request_time"]) +def test_historical_retrieval_preserves_internal_named_request_columns( + tmp_path: Path, +) -> None: + store = _store(tmp_path, timedelta(days=1)) + entity_df = _entities().assign( + __chronon_row_id=[10, 20], __chronon_row_id_=[30, 40] + ) + result = store.get_historical_features( + entity_df=entity_df, features=["profile:feature_a"] + ).to_df() + pd.testing.assert_frame_equal(result[entity_df.columns], entity_df) + assert result["feature_a"].tolist() == [4.0, 2.0] + + +def test_historical_retrieval_without_entities(tmp_path: Path) -> None: + store = _store(tmp_path, timedelta(days=1)) + path = tmp_path / "global.parquet" + pd.DataFrame( + { + "event_timestamp": pd.to_datetime(["2024-01-01", "2024-01-03"], utc=True), + "value": [2.0, 4.0], + } + ).to_parquet(path) + store.apply( + FeatureView( + name="global_stats", + entities=[], + ttl=timedelta(days=1), + schema=[Field(name="value", dtype=Float32)], + source=ChrononSource( + materialization_path=str(path), timestamp_field="event_timestamp" + ), + online=False, + ) + ) + entity_df = pd.DataFrame( + { + "event_timestamp": pd.to_datetime( + ["2024-01-03", "2024-01-02", "2024-01-06"], utc=True + ) + } + ) + result = store.get_historical_features( + entity_df=entity_df, features=["global_stats:value"] + ).to_df() + assert result["value"].iloc[:2].tolist() == [4.0, 2.0] + assert pd.isna(result["value"].iloc[2]) + pd.testing.assert_series_equal( + result["event_timestamp"], entity_df["event_timestamp"] + ) + + def test_historical_retrieval_infers_partitioned_entity(tmp_path: Path) -> None: store = _store(tmp_path, timedelta(days=1), partitioned=True) assert store.get_feature_view("profile").join_keys == ["user_id"] From eae98902b0d76bad50592a2d592a3760a1bb65bd Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Mon, 5 Oct 2026 10:48:42 -0400 Subject: [PATCH 10/11] fix: Make Chronon demo setup reproducible and surface startup failures Signed-off-by: Francisco Javier Arceo --- .../pr_chronon_integration_tests.yml | 2 +- README.md | 3 +++ docs/reference/offline-stores/README.md | 4 ++++ docs/reference/offline-stores/overview.md | 7 +++++- docs/reference/online-stores/README.md | 4 ++++ examples/chronon/README.md | 5 ++++ .../chronon/start-local-chronon-service.sh | 11 +++++++-- .../test_chronon_local_service_script.py | 24 ++++++++++++------- 8 files changed, 48 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr_chronon_integration_tests.yml b/.github/workflows/pr_chronon_integration_tests.yml index a3d7de8aed3..2afdf0bf324 100644 --- a/.github/workflows/pr_chronon_integration_tests.yml +++ b/.github/workflows/pr_chronon_integration_tests.yml @@ -102,7 +102,7 @@ jobs: sudo mkdir -p /usr/src/thrift sudo tar zxf /tmp/thrift.tar.gz -C /usr/src/thrift --strip-components=1 cd /usr/src/thrift - sudo ./configure --without-python --without-cpp + sudo ./configure --disable-libs --disable-tests --disable-tutorial sudo make -j2 sudo make install python3 -m pip install --break-system-packages build diff --git a/README.md b/README.md index a91faccae83..942d6d0856e 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,7 @@ The list below contains the functionality that contributors are planning to deve * [x] Vector Search (Alpha release. See [RFC](https://docs.google.com/document/d/18IWzLEA9i2lDWnbfbwXnMCg3StlqaLVI-uRpQjr_Vos/edit#heading=h.9gaqqtox9jg6)) * [ ] [Enhanced Feature Server and SDK for native support for NLP](https://github.com/feast-dev/feast/issues/4964) * **Data Sources** + * [x] [Chronon source (contrib)](https://docs.feast.dev/reference/data-sources/chronon) * [x] [Snowflake source](https://docs.feast.dev/reference/data-sources/snowflake) * [x] [Redshift source](https://docs.feast.dev/reference/data-sources/redshift) * [x] [BigQuery source](https://docs.feast.dev/reference/data-sources/bigquery) @@ -189,6 +190,7 @@ The list below contains the functionality that contributors are planning to deve * [x] [Ray source (contrib plugin)](https://docs.feast.dev/reference/data-sources/ray) * [x] Kafka / Kinesis sources (via [push support into the online store](https://docs.feast.dev/reference/data-sources/push)) * **Offline Stores** + * [x] [Chronon (contrib)](https://docs.feast.dev/reference/offline-stores/chronon) * [x] [Snowflake](https://docs.feast.dev/reference/offline-stores/snowflake) * [x] [Redshift](https://docs.feast.dev/reference/offline-stores/redshift) * [x] [BigQuery](https://docs.feast.dev/reference/offline-stores/bigquery) @@ -209,6 +211,7 @@ The list below contains the functionality that contributors are planning to deve * [x] [Hybrid](https://docs.feast.dev/reference/offline-stores/hybrid) * [x] [Custom offline store support](https://docs.feast.dev/how-to-guides/customizing-feast/adding-a-new-offline-store) * **Online Stores** + * [x] [Chronon](https://docs.feast.dev/reference/online-stores/chronon) * [x] [Snowflake](https://docs.feast.dev/reference/online-stores/snowflake) * [x] [DynamoDB](https://docs.feast.dev/reference/online-stores/dynamodb) * [x] [Redis](https://docs.feast.dev/reference/online-stores/redis) diff --git a/docs/reference/offline-stores/README.md b/docs/reference/offline-stores/README.md index 1c0d24c8d07..f1c6951a3a1 100644 --- a/docs/reference/offline-stores/README.md +++ b/docs/reference/offline-stores/README.md @@ -6,6 +6,10 @@ Please see [Offline Store](../../getting-started/components/offline-store.md) fo [overview.md](overview.md) {% endcontent-ref %} +{% content-ref url="chronon.md" %} +[chronon.md](chronon.md) +{% endcontent-ref %} + {% content-ref url="dask.md" %} [dask.md](dask.md) {% endcontent-ref %} diff --git a/docs/reference/offline-stores/overview.md b/docs/reference/offline-stores/overview.md index 24d37da22f1..f80e86887f4 100644 --- a/docs/reference/offline-stores/overview.md +++ b/docs/reference/offline-stores/overview.md @@ -29,6 +29,11 @@ There are currently four core offline store implementations: `DaskOfflineStore`, There are several additional implementations contributed by the Feast community (`PostgreSQLOfflineStore`, `SparkOfflineStore`, `TrinoOfflineStore`, and `RayOfflineStore`), which are not guaranteed to be stable or to match the functionality of the core implementations. Details for each specific offline store, such as how to configure it in a `feature_store.yaml`, can be found [here](README.md). +The community [Chronon offline store](chronon.md) reads materialized Parquet with +point-in-time joins and supports local on-demand transforms and Parquet saved +datasets. Computation and materialization remain managed by Chronon; see its +[functionality matrix](chronon.md#functionality-matrix) for supported operations. + Below is a matrix indicating which offline stores support which methods. || | Dask | BigQuery | Snowflake | Redshift | Postgres | Spark | Trino | Couchbase | Ray | @@ -55,4 +60,4 @@ Below is a matrix indicating which `RetrievalJob`s support what functionality. || remote execution of Python-based on-demand transforms | no | no | no | no | no | no | no | no | no | no | || persist results in the offline store | yes | yes | yes | yes | yes | yes | no | yes | yes | yes | || preview the query plan before execution | yes | yes | yes | yes | yes | yes | yes | no | yes | yes | -|| read partitioned data | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | \ No newline at end of file +|| read partitioned data | yes | yes | yes | yes | yes | yes | yes | yes | yes | yes | diff --git a/docs/reference/online-stores/README.md b/docs/reference/online-stores/README.md index 257864b9b30..82f7388bd72 100644 --- a/docs/reference/online-stores/README.md +++ b/docs/reference/online-stores/README.md @@ -6,6 +6,10 @@ Please see [Online Store](../../getting-started/components/online-store.md) for [overview.md](overview.md) {% endcontent-ref %} +{% content-ref url="chronon.md" %} +[chronon.md](chronon.md) +{% endcontent-ref %} + {% content-ref url="sqlite.md" %} [sqlite.md](sqlite.md) {% endcontent-ref %} diff --git a/examples/chronon/README.md b/examples/chronon/README.md index cf019c0e4d2..80b5369c2f6 100644 --- a/examples/chronon/README.md +++ b/examples/chronon/README.md @@ -13,6 +13,11 @@ uv run python examples/chronon/run_demo.py --offline-only ## Live Chronon Service +The pinned quickstart Docker image is ARM64. Use an ARM64 Docker host (as in +the integration workflow), or provide a compatible image for your host with +`CHRONON_QUICKSTART_IMAGE`. Docker must be running and accessible to your user. +The launcher uses MongoDB 7.0; `CHRONON_MONGO_IMAGE` overrides that image. + Install `sbt` and a JDK. On macOS with Homebrew, this is enough: ```bash diff --git a/infra/scripts/chronon/start-local-chronon-service.sh b/infra/scripts/chronon/start-local-chronon-service.sh index f2b3536350a..7ba1e795e51 100755 --- a/infra/scripts/chronon/start-local-chronon-service.sh +++ b/infra/scripts/chronon/start-local-chronon-service.sh @@ -14,6 +14,8 @@ SERVICE_PID_FILE="${CHRONON_SERVICE_PID_FILE:-/tmp/chronon-service.pid}" SERVICE_LOG_FILE="${CHRONON_SERVICE_LOG_FILE:-/tmp/chronon-service.log}" JAVA_BIN="${JAVA_BIN:-java}" PYTHON_BIN="${PYTHON_BIN:-python3}" +QUICKSTART_IMAGE="${CHRONON_QUICKSTART_IMAGE:-ezvz/chronon@sha256:a3f6b5e1aa85bb23269ebd67fc7e4b0fb2d0cf3e53bc2a45abdc23c95769415c}" +MONGO_IMAGE="${CHRONON_MONGO_IMAGE:-mongo:7.0@sha256:1f995ad6fdb93244a1addab1b58f934a0bc2f5643c38e02f5e9d7f0c7d227a7b}" CHRONON_PREFLIGHT_ONLY="${CHRONON_PREFLIGHT_ONLY:-0}" MONGO_IMPL_JAR="${CHRONON_DIR}/quickstart/mongo-online-impl/target/scala-2.12/mongo-online-impl-assembly-0.1.0-SNAPSHOT.jar" SERVICE_TARGET_DIR="${CHRONON_DIR}/service/target/scala-2.12" @@ -94,6 +96,11 @@ cleanup_stale_service() { wait_for_mongo() { local attempts=60 until docker exec "${MONGO_CONTAINER}" mongosh --quiet --eval 'db.runCommand({ ping: 1 }).ok' >/dev/null 2>&1; do + if [[ "$(docker inspect --format '{{.State.Running}}' "${MONGO_CONTAINER}")" != "true" ]]; then + echo "Mongo container exited before becoming ready." >&2 + docker logs "${MONGO_CONTAINER}" >&2 || true + exit 1 + fi attempts=$((attempts - 1)) if [[ "${attempts}" -le 0 ]]; then echo "Mongo did not become ready in time." >&2 @@ -163,7 +170,7 @@ docker run -d \ -p 27017:27017 \ -e MONGO_INITDB_ROOT_USERNAME=admin \ -e MONGO_INITDB_ROOT_PASSWORD=admin \ - mongo:latest >/dev/null + "${MONGO_IMAGE}" >/dev/null wait_for_mongo @@ -184,7 +191,7 @@ docker run -d \ -e CHRONON_ONLINE_CLASS=ai.chronon.quickstart.online.ChrononMongoOnlineImpl \ -e "CHRONON_ONLINE_ARGS=-Zuser=admin -Zpassword=admin -Zhost=${MONGO_CONTAINER} -Zport=27017 -Zdatabase=admin" \ -v "${CHRONON_DIR}/quickstart/mongo-online-impl:/srv/onlineImpl" \ - ezvz/chronon \ + "${QUICKSTART_IMAGE}" \ bash -lc '/opt/spark/bin/spark-shell -i scripts/data-loader.scala && touch /tmp/chronon-data-load.complete && tail -f /dev/null' >/dev/null wait_for_data_load diff --git a/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py b/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py index c04260efc4f..e9505157c62 100644 --- a/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py +++ b/sdk/python/tests/unit/infra/scripts/test_chronon_local_service_script.py @@ -43,9 +43,9 @@ def test_start_script_can_fail_before_docker_when_repo_missing(tmp_path: Path): assert "git clone" in result.stderr -@pytest.mark.parametrize("loader_fails", [False, True]) -def test_start_script_waits_for_completed_data_load( - tmp_path: Path, loader_fails: bool +@pytest.mark.parametrize("failed_container", ["", "chronon-main", "chronon-mongo"]) +def test_start_script_requires_ready_containers( + tmp_path: Path, failed_container: str ) -> None: chronon_repo = tmp_path / "chronon" jar = ( @@ -68,9 +68,12 @@ def test_start_script_waits_for_completed_data_load( args = sys.argv[1:] state = Path(os.environ['TEST_DOCKER_STATE']) -failed = os.environ['TEST_LOADER_FAILS'] == '1' +failed_container = os.environ['TEST_FAILED_CONTAINER'] +failed = failed_container == 'chronon-main' if args[0] == 'run' and 'chronon-main' in args: state.write_text('0') +elif args[:2] == ['exec', 'chronon-mongo']: + sys.exit(1 if failed_container == 'chronon-mongo' else 0) elif args[:2] == ['logs', 'chronon-main']: print("Spark session available as 'spark'.") elif args[:3] == ['exec', 'chronon-main', 'test']: @@ -78,7 +81,7 @@ def test_start_script_waits_for_completed_data_load( state.write_text(str(polls)) sys.exit(0 if polls >= 2 and not failed else 1) elif args[0] == 'inspect': - print('false' if failed else 'true') + print('false' if args[-1] == failed_container else 'true') elif args[:3] == ['exec', 'chronon-main', 'bash']: if failed or int(state.read_text()) < 2: print('Upload started before successful data load', file=sys.stderr) @@ -103,17 +106,22 @@ def test_start_script_waits_for_completed_data_load( "CHRONON_PREFLIGHT_ONLY": "0", "PYTHON_BIN": "/usr/bin/true", "TEST_DOCKER_STATE": str(state), - "TEST_LOADER_FAILS": "1" if loader_fails else "0", + "TEST_FAILED_CONTAINER": failed_container, }, capture_output=True, text=True, timeout=15, check=False, ) - if loader_fails: + if failed_container: assert result.returncode == 1 assert not state.with_suffix(".uploaded").exists() - assert "data loader exited" in result.stderr + expected = ( + "data loader exited" + if failed_container == "chronon-main" + else "Mongo container exited" + ) + assert expected in result.stderr else: assert result.returncode == 0, result.stderr assert state.with_suffix(".uploaded").exists() From 1274ce3689ebf0bca8b22fe617422910d61d5293 Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Mon, 5 Oct 2026 10:59:08 -0400 Subject: [PATCH 11/11] fix: Stabilize Chronon CI setup and generated documentation Signed-off-by: Francisco Javier Arceo --- .github/workflows/pr_chronon_integration_tests.yml | 5 ++++- docs/roadmap.md | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_chronon_integration_tests.yml b/.github/workflows/pr_chronon_integration_tests.yml index 2afdf0bf324..61896925fe1 100644 --- a/.github/workflows/pr_chronon_integration_tests.yml +++ b/.github/workflows/pr_chronon_integration_tests.yml @@ -97,11 +97,14 @@ jobs: pkg-config \ python3-pip \ python3-venv - curl -fsSL "https://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.tar.gz" -o /tmp/thrift.tar.gz + curl -fsSL --retry 3 --connect-timeout 15 \ + "https://github.com/apache/thrift/archive/refs/tags/v0.13.0.tar.gz" \ + -o /tmp/thrift.tar.gz sudo rm -rf /usr/src/thrift sudo mkdir -p /usr/src/thrift sudo tar zxf /tmp/thrift.tar.gz -C /usr/src/thrift --strip-components=1 cd /usr/src/thrift + sudo ./bootstrap.sh sudo ./configure --disable-libs --disable-tests --disable-tutorial sudo make -j2 sudo make install diff --git a/docs/roadmap.md b/docs/roadmap.md index d92ffa38f24..f9a479365b7 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -8,6 +8,7 @@ The list below contains the functionality that contributors are planning to deve * [x] Vector Search (Alpha release. See [RFC](https://docs.google.com/document/d/18IWzLEA9i2lDWnbfbwXnMCg3StlqaLVI-uRpQjr_Vos/edit#heading=h.9gaqqtox9jg6)) * [ ] [Enhanced Feature Server and SDK for native support for NLP](https://github.com/feast-dev/feast/issues/4964) * **Data Sources** + * [x] [Chronon source (contrib)](https://docs.feast.dev/reference/data-sources/chronon) * [x] [Snowflake source](https://docs.feast.dev/reference/data-sources/snowflake) * [x] [Redshift source](https://docs.feast.dev/reference/data-sources/redshift) * [x] [BigQuery source](https://docs.feast.dev/reference/data-sources/bigquery) @@ -24,6 +25,7 @@ The list below contains the functionality that contributors are planning to deve * [x] [Ray source (contrib plugin)](https://docs.feast.dev/reference/data-sources/ray) * [x] Kafka / Kinesis sources (via [push support into the online store](https://docs.feast.dev/reference/data-sources/push)) * **Offline Stores** + * [x] [Chronon (contrib)](https://docs.feast.dev/reference/offline-stores/chronon) * [x] [Snowflake](https://docs.feast.dev/reference/offline-stores/snowflake) * [x] [Redshift](https://docs.feast.dev/reference/offline-stores/redshift) * [x] [BigQuery](https://docs.feast.dev/reference/offline-stores/bigquery) @@ -44,6 +46,7 @@ The list below contains the functionality that contributors are planning to deve * [x] [Hybrid](https://docs.feast.dev/reference/offline-stores/hybrid) * [x] [Custom offline store support](https://docs.feast.dev/how-to-guides/customizing-feast/adding-a-new-offline-store) * **Online Stores** + * [x] [Chronon](https://docs.feast.dev/reference/online-stores/chronon) * [x] [Snowflake](https://docs.feast.dev/reference/online-stores/snowflake) * [x] [DynamoDB](https://docs.feast.dev/reference/online-stores/dynamodb) * [x] [Redis](https://docs.feast.dev/reference/online-stores/redis)