Skip to content

Commit

Permalink
SAASMLOPS-734 bytewax in-cluster config, custom labels, fix worker im…
Browse files Browse the repository at this point in the history
…age deps

Signed-off-by: James Crabtree <james.crabtree@sailpoint.com>
  • Loading branch information
james-crabtree-sp committed Sep 1, 2023
1 parent 58aff34 commit ca442ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class BytewaxMaterializationEngineConfig(FeastConfigBaseModel):
include_security_context_capabilities: bool = True
""" (optional) Include security context capabilities in the init and job container spec """

labels: dict = {}
""" (optional) additional labels to append to kubernetes objects """


class BytewaxMaterializationEngine(BatchMaterializationEngine):
def __init__(
Expand All @@ -82,7 +85,7 @@ def __init__(
self.online_store = online_store

# TODO: Configure k8s here
k8s_config.load_kube_config()
k8s_config.load_config()

self.k8s_client = client.api_client.ApiClient()
self.v1 = client.CoreV1Api(self.k8s_client)
Expand Down Expand Up @@ -196,14 +199,13 @@ def _create_configuration_map(self, job_id, paths, feature_view, namespace):
{"paths": paths, "feature_view": feature_view.name}
)

labels = {"feast-bytewax-materializer": "configmap"}
configmap_manifest = {
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": f"feast-{job_id}",
"labels": {
"feast-bytewax-materializer": "configmap",
},
"labels": {**labels, **self.batch_engine_config.labels},
},
"data": {
"feature_store.yaml": feature_store_configuration,
Expand Down Expand Up @@ -260,15 +262,15 @@ def _create_job_definition(self, job_id, namespace, pods, env):
"drop": ["ALL"],
}

job_labels = {"feast-bytewax-materializer": "job"}
pod_labels = {"feast-bytewax-materializer": "pod"}
job_definition = {
"apiVersion": "batch/v1",
"kind": "Job",
"metadata": {
"name": f"dataflow-{job_id}",
"namespace": namespace,
"labels": {
"feast-bytewax-materializer": "job",
},
"labels": {**job_labels, **self.batch_engine_config.labels},
},
"spec": {
"ttlSecondsAfterFinished": 3600,
Expand All @@ -278,9 +280,7 @@ def _create_job_definition(self, job_id, namespace, pods, env):
"template": {
"metadata": {
"annotations": self.batch_engine_config.annotations,
"labels": {
"feast-bytewax-materializer": "pod",
},
"labels": {**pod_labels, **self.batch_engine_config.labels},
},
"spec": {
"restartPolicy": "Never",
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"bowler", # Needed for automatic repo upgrades
# FastAPI does not correctly pull starlette dependency on httpx see thread(https://github.com/tiangolo/fastapi/issues/5656).
"httpx>=0.23.3",
"pyOpenSSL"
]

GCP_REQUIRED = [
Expand All @@ -93,7 +94,7 @@
"hiredis>=2.0.0,<3",
]

AWS_REQUIRED = ["boto3>=1.17.0,<2", "docker>=5.0.2"]
AWS_REQUIRED = ["boto3>=1.17.0,<2", "docker>=5.0.2", "s3fs"]

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

Expand Down

0 comments on commit ca442ad

Please sign in to comment.