Skip to content

Commit 227f8f4

Browse files
committed
update API
Signed-off-by: HaoXuAI <sduxuhao@gmail.com>
1 parent 6b57e94 commit 227f8f4

7 files changed

Lines changed: 39 additions & 28 deletions

File tree

‎docs/reference/compute-engine/README.md‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ This system builds and executes DAGs (Directed Acyclic Graphs) of typed operatio
1313

1414
## 🧠 Core Concepts
1515

16-
| Component | Description |
17-
|--------------------|--------------------------------------------------------------------|
18-
| `ComputeEngine` | Interface for executing materialization and retrieval tasks |
19-
| `FeatureBuilder` | Constructs a DAG for a specific backend |
20-
| `DAGNode` | Represents a logical operation (read, aggregate, join, etc.) |
21-
| `ExecutionPlan` | Executes nodes in dependency order and stores intermediate outputs |
22-
| `ExecutionContext` | Holds config, registry, stores, entity data, and node outputs |
16+
| Component | Description |
17+
|--------------------|----------------------------------------------------------------------|
18+
| `ComputeEngine` | Interface for executing materialization and retrieval tasks |
19+
| `FeatureBuilder` | Constructs a DAG from Feature View definition for a specific backend |
20+
| `DAGNode` | Represents a logical operation (read, aggregate, join, etc.) |
21+
| `ExecutionPlan` | Executes nodes in dependency order and stores intermediate outputs |
22+
| `ExecutionContext` | Holds config, registry, stores, entity data, and node outputs |
2323

2424
---
2525

@@ -52,6 +52,9 @@ To create your own compute engine:
5252
1. **Implement the interface**
5353

5454
```python
55+
from feast.infra.compute_engines.base import ComputeEngine
56+
from feast.infra.materialization.batch_materialization_engine import MaterializationTask, MaterializationJob
57+
from feast.infra.compute_engines.tasks import HistoricalRetrievalTask
5558
class MyComputeEngine(ComputeEngine):
5659
def materialize(self, task: MaterializationTask) -> MaterializationJob:
5760
...
@@ -62,7 +65,9 @@ class MyComputeEngine(ComputeEngine):
6265

6366
2. Create a FeatureBuilder
6467
```python
65-
class MyDAGBuilder(FeatureBuilder):
68+
from feast.infra.compute_engines.feature_builder import FeatureBuilder
69+
70+
class CustomFeatureBuilder(FeatureBuilder):
6671
def build_source_node(self): ...
6772
def build_aggregation_node(self, input_node): ...
6873
def build_join_node(self, input_node): ...

‎sdk/python/feast/infra/compute_engines/base.py‎

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
from abc import ABC
2-
from dataclasses import dataclass
3-
from datetime import datetime
4-
from typing import Union
52

6-
import pandas as pd
73
import pyarrow as pa
84

9-
from feast import BatchFeatureView, RepoConfig, StreamFeatureView
5+
from feast import RepoConfig
6+
from feast.infra.compute_engines.tasks import HistoricalRetrievalTask
107
from feast.infra.materialization.batch_materialization_engine import (
118
MaterializationJob,
129
MaterializationTask,
@@ -16,17 +13,6 @@
1613
from feast.infra.registry.registry import Registry
1714

1815

19-
@dataclass
20-
class HistoricalRetrievalTask:
21-
entity_df: Union[pd.DataFrame, str]
22-
feature_view: Union[BatchFeatureView, StreamFeatureView]
23-
full_feature_name: bool
24-
registry: Registry
25-
config: RepoConfig
26-
start_time: datetime
27-
end_time: datetime
28-
29-
3016
class ComputeEngine(ABC):
3117
"""
3218
The interface that Feast uses to control the compute system that handles materialization and get_historical_features.

‎sdk/python/feast/infra/compute_engines/feature_builder.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from typing import Union
33

44
from feast import BatchFeatureView, FeatureView, StreamFeatureView
5-
from feast.infra.compute_engines.base import HistoricalRetrievalTask
65
from feast.infra.compute_engines.dag.node import DAGNode
76
from feast.infra.compute_engines.dag.plan import ExecutionPlan
7+
from feast.infra.compute_engines.tasks import HistoricalRetrievalTask
88
from feast.infra.materialization.batch_materialization_engine import MaterializationTask
99

1010

‎sdk/python/feast/infra/compute_engines/spark/compute.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from feast.infra.compute_engines.base import ComputeEngine, HistoricalRetrievalTask
1+
from feast.infra.compute_engines.base import ComputeEngine
22
from feast.infra.compute_engines.dag.context import ExecutionContext
33
from feast.infra.compute_engines.spark.feature_builder import SparkFeatureBuilder
44
from feast.infra.compute_engines.spark.job import SparkDAGRetrievalJob
55
from feast.infra.compute_engines.spark.utils import get_or_create_new_spark_session
6+
from feast.infra.compute_engines.tasks import HistoricalRetrievalTask
67
from feast.infra.materialization.batch_materialization_engine import (
78
MaterializationJob,
89
MaterializationJobStatus,

‎sdk/python/feast/infra/compute_engines/spark/node.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
from feast import BatchFeatureView, StreamFeatureView
99
from feast.aggregation import Aggregation
10-
from feast.infra.compute_engines.base import HistoricalRetrievalTask
1110
from feast.infra.compute_engines.dag.context import ExecutionContext
1211
from feast.infra.compute_engines.dag.model import DAGFormat
1312
from feast.infra.compute_engines.dag.node import DAGNode
1413
from feast.infra.compute_engines.dag.value import DAGValue
14+
from feast.infra.compute_engines.tasks import HistoricalRetrievalTask
1515
from feast.infra.materialization.batch_materialization_engine import MaterializationTask
1616
from feast.infra.materialization.contrib.spark.spark_materialization_engine import (
1717
_map_by_partition,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from dataclasses import dataclass
2+
from datetime import datetime
3+
from typing import Union
4+
5+
import pandas as pd
6+
7+
from feast import BatchFeatureView, RepoConfig, StreamFeatureView
8+
from feast.infra.registry.registry import Registry
9+
10+
11+
@dataclass
12+
class HistoricalRetrievalTask:
13+
entity_df: Union[pd.DataFrame, str]
14+
feature_view: Union[BatchFeatureView, StreamFeatureView]
15+
full_feature_name: bool
16+
registry: Registry
17+
config: RepoConfig
18+
start_time: datetime
19+
end_time: datetime

‎sdk/python/tests/integration/compute_engines/spark/test_compute.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import pytest
77

88
from feast import BatchFeatureView
9-
from feast.infra.compute_engines.base import HistoricalRetrievalTask
109
from feast.infra.compute_engines.spark.compute import SparkComputeEngine
1110
from feast.infra.compute_engines.spark.job import SparkDAGRetrievalJob
11+
from feast.infra.compute_engines.tasks import HistoricalRetrievalTask
1212
from feast.infra.offline_stores.contrib.spark_offline_store.spark import (
1313
SparkOfflineStore,
1414
)

0 commit comments

Comments
 (0)