Skip to content

Commit 2192e65

Browse files
feat: Add support for in_cluster config and additional labels for bytewax materialization (feast-dev#3754)
* SAASMLOPS-734 bytewax in-cluster config, custom labels, fix worker image deps Signed-off-by: James Crabtree <james.crabtree@sailpoint.com> * SAASMLOPS-769 make max parallelism configurable Signed-off-by: James Crabtree <james.crabtree@sailpoint.com> --------- Signed-off-by: James Crabtree <james.crabtree@sailpoint.com>
1 parent 04804a0 commit 2192e65

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_engine.py

+14-11
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ class BytewaxMaterializationEngineConfig(FeastConfigBaseModel):
6161
include_security_context_capabilities: bool = True
6262
""" (optional) Include security context capabilities in the init and job container spec """
6363

64+
labels: dict = {}
65+
""" (optional) additional labels to append to kubernetes objects """
66+
67+
max_parallelism: int = 10
68+
""" (optional) Maximum number of pods (default 10) allowed to run in parallel per job"""
69+
6470

6571
class BytewaxMaterializationEngine(BatchMaterializationEngine):
6672
def __init__(
@@ -82,7 +88,7 @@ def __init__(
8288
self.online_store = online_store
8389

8490
# TODO: Configure k8s here
85-
k8s_config.load_kube_config()
91+
k8s_config.load_config()
8692

8793
self.k8s_client = client.api_client.ApiClient()
8894
self.v1 = client.CoreV1Api(self.k8s_client)
@@ -196,14 +202,13 @@ def _create_configuration_map(self, job_id, paths, feature_view, namespace):
196202
{"paths": paths, "feature_view": feature_view.name}
197203
)
198204

205+
labels = {"feast-bytewax-materializer": "configmap"}
199206
configmap_manifest = {
200207
"kind": "ConfigMap",
201208
"apiVersion": "v1",
202209
"metadata": {
203210
"name": f"feast-{job_id}",
204-
"labels": {
205-
"feast-bytewax-materializer": "configmap",
206-
},
211+
"labels": {**labels, **self.batch_engine_config.labels},
207212
},
208213
"data": {
209214
"feature_store.yaml": feature_store_configuration,
@@ -260,27 +265,25 @@ def _create_job_definition(self, job_id, namespace, pods, env):
260265
"drop": ["ALL"],
261266
}
262267

268+
job_labels = {"feast-bytewax-materializer": "job"}
269+
pod_labels = {"feast-bytewax-materializer": "pod"}
263270
job_definition = {
264271
"apiVersion": "batch/v1",
265272
"kind": "Job",
266273
"metadata": {
267274
"name": f"dataflow-{job_id}",
268275
"namespace": namespace,
269-
"labels": {
270-
"feast-bytewax-materializer": "job",
271-
},
276+
"labels": {**job_labels, **self.batch_engine_config.labels},
272277
},
273278
"spec": {
274279
"ttlSecondsAfterFinished": 3600,
275280
"completions": pods,
276-
"parallelism": pods,
281+
"parallelism": min(pods, self.batch_engine_config.max_parallelism),
277282
"completionMode": "Indexed",
278283
"template": {
279284
"metadata": {
280285
"annotations": self.batch_engine_config.annotations,
281-
"labels": {
282-
"feast-bytewax-materializer": "pod",
283-
},
286+
"labels": {**pod_labels, **self.batch_engine_config.labels},
284287
},
285288
"spec": {
286289
"restartPolicy": "Never",

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"hiredis>=2.0.0,<3",
9999
]
100100

101-
AWS_REQUIRED = ["boto3>=1.17.0,<2", "docker>=5.0.2"]
101+
AWS_REQUIRED = ["boto3>=1.17.0,<2", "docker>=5.0.2", "s3fs"]
102102

103103
BYTEWAX_REQUIRED = ["bytewax==0.15.1", "docker>=5.0.2", "kubernetes<=20.13.0"]
104104

0 commit comments

Comments
 (0)