Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial docker image for aws lambda feature server #1866

Merged
merged 3 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions sdk/python/feast/infra/feature_servers/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM public.ecr.aws/lambda/python:3.9

# Copy app handler code
COPY sdk/python/feast/infra/feature_servers/aws_lambda/app.py ${LAMBDA_TASK_ROOT}

# Copy necessary parts of the Feast codebase
COPY sdk/python sdk/python
COPY protos protos
COPY README.md README.md

# Install Feast for AWS with Lambda dependencies
RUN pip3 install -e 'sdk/python[aws,redis]'
RUN pip3 install -r sdk/python/feast/infra/feature_servers/aws_lambda/requirements.txt --target "${LAMBDA_TASK_ROOT}"
tsotnet marked this conversation as resolved.
Show resolved Hide resolved

ENV FEAST_USAGE=False
tsotnet marked this conversation as resolved.
Show resolved Hide resolved

# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "app.handler" ]
13 changes: 13 additions & 0 deletions sdk/python/feast/infra/feature_servers/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from mangum import Mangum

import feast
from feast.feature_server import get_app

# TODO: replace this with an actual feature repo config deserialized from the env variables
tsotnet marked this conversation as resolved.
Show resolved Hide resolved
config = feast.RepoConfig()

store = feast.FeatureStore(config=config)

app = get_app(store)

handler = Mangum(app)
2 changes: 2 additions & 0 deletions sdk/python/feast/infra/feature_servers/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fastapi
mangum
18 changes: 11 additions & 7 deletions sdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
import glob
import os
import re
import shutil
import subprocess
import pathlib

from distutils.cmd import Command
from setuptools import find_packages
Expand Down Expand Up @@ -116,14 +118,10 @@
"dill==0.3.0"
]

# Get git repo root directory
repo_root = str(pathlib.Path(__file__).resolve().parent.parent.parent)

# README file from Feast repo root directory
repo_root = (
subprocess.Popen(["git", "rev-parse", "--show-toplevel"], stdout=subprocess.PIPE)
.communicate()[0]
.rstrip()
.decode("utf-8")
)
README_FILE = os.path.join(repo_root, "README.md")
with open(README_FILE, "r") as f:
LONG_DESCRIPTION = f.read()
Expand All @@ -135,6 +133,12 @@
r"^(?:[\/\w-]+)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$"
)

# Only set use_scm_version if git executable exists (setting this variable causes pip to use git under the hood)
if shutil.which("git"):
use_scm_version = {"root": "../..", "relative_to": __file__, "tag_regex": TAG_REGEX}
else:
use_scm_version = None


class BuildProtoCommand(Command):
description = "Builds the proto files into python files."
Expand Down Expand Up @@ -223,7 +227,7 @@ def run(self):
"Programming Language :: Python :: 3.7",
],
entry_points={"console_scripts": ["feast=feast.cli:cli"]},
use_scm_version={"root": "../..", "relative_to": __file__, "tag_regex": TAG_REGEX},
use_scm_version=use_scm_version,
setup_requires=["setuptools_scm", "grpcio", "grpcio-tools==1.34.0", "mypy-protobuf", "sphinx!=4.0.0"],
package_data={
"": [
Expand Down