Skip to content

Commit 514666f

Browse files
fix: Add spark to lambda dockerfile (#2480)
* add spark to lambda dockerfile Signed-off-by: Achal Shah <[email protected]> * add *args Signed-off-by: Achal Shah <[email protected]> * Add *args Signed-off-by: Felix Wang <[email protected]> * Pin protobuf==3.19.4 Signed-off-by: Felix Wang <[email protected]> * Remove *args Signed-off-by: Felix Wang <[email protected]> * Add a range Signed-off-by: Achal Shah <[email protected]> * Add a todo Signed-off-by: Achal Shah <[email protected]> * cleanup prints Signed-off-by: Achal Shah <[email protected]> * lock deps Signed-off-by: Achal Shah <[email protected]> * lock deps correctly Signed-off-by: Achal Shah <[email protected]> * fix lint Signed-off-by: Achal Shah <[email protected]> * fix lint take 2 Signed-off-by: Achal Shah <[email protected]> * Undo general updates Signed-off-by: Achal Shah <[email protected]> Co-authored-by: Felix Wang <[email protected]>
1 parent 37971a4 commit 514666f

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

sdk/python/feast/infra/feature_servers/aws_lambda/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ COPY go go
1010
COPY README.md README.md
1111

1212
# Install Feast for AWS with Lambda dependencies
13-
RUN pip3 install -e 'sdk/python[aws,redis]'
13+
# TODO(achals): The additional spark deps should be removed. Details at https://github.com/feast-dev/feast/pull/2480.
14+
RUN pip3 install -e 'sdk/python[aws,redis,spark]'
1415
RUN pip3 install -r sdk/python/feast/infra/feature_servers/aws_lambda/requirements.txt --target "${LAMBDA_TASK_ROOT}"
1516

1617
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)

sdk/python/feast/infra/offline_stores/bigquery.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,14 @@ def to_bigquery(
338338

339339
def _to_arrow_internal(self) -> pyarrow.Table:
340340
with self._query_generator() as query:
341-
return self._execute_query(query).to_arrow()
341+
q = self._execute_query(query=query)
342+
assert q
343+
return q.to_arrow()
342344

343345
@log_exceptions_and_usage
344346
def _execute_query(
345347
self, query, job_config=None, timeout: int = 1800
346-
) -> bigquery.job.query.QueryJob:
348+
) -> Optional[bigquery.job.query.QueryJob]:
347349
bq_job = self.client.query(query, job_config=job_config)
348350

349351
if job_config and job_config.dry_run:
@@ -426,7 +428,7 @@ def _get_table_reference_for_new_entity(
426428
dataset.location = dataset_location if dataset_location else "US"
427429

428430
try:
429-
client.get_dataset(dataset)
431+
client.get_dataset(dataset.reference)
430432
except NotFound:
431433
# Only create the dataset if it does not exist
432434
client.create_dataset(dataset, exists_ok=True)

sdk/python/feast/proto_json.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
JsonObject = Any
1616

1717

18+
# TODO: These methods need to be updated when bumping the version of protobuf.
19+
# https://github.com/feast-dev/feast/issues/2484
1820
def _patch_proto_json_encoding(
1921
proto_type: Type[ProtoMessage],
2022
to_json_object: Callable[[_Printer, ProtoMessage], JsonObject],
@@ -68,7 +70,7 @@ def to_json_object(printer: _Printer, message: ProtoMessage) -> JsonObject:
6870
return value
6971

7072
def from_json_object(
71-
parser: _Parser, value: JsonObject, message: ProtoMessage
73+
parser: _Parser, value: JsonObject, message: ProtoMessage,
7274
) -> None:
7375
if value is None:
7476
message.null_val = 0
@@ -140,7 +142,7 @@ def to_json_object(printer: _Printer, message: ProtoMessage) -> JsonObject:
140142
return [printer._MessageToJsonObject(item) for item in message.val]
141143

142144
def from_json_object(
143-
parser: _Parser, value: JsonObject, message: ProtoMessage
145+
parser: _Parser, value: JsonObject, message: ProtoMessage,
144146
) -> None:
145147
array = value if isinstance(value, list) else value["val"]
146148
for item in array:
@@ -181,7 +183,7 @@ def to_json_object(printer: _Printer, message: ProtoMessage) -> JsonObject:
181183
return list(message.val)
182184

183185
def from_json_object(
184-
parser: _Parser, value: JsonObject, message: ProtoMessage
186+
parser: _Parser, value: JsonObject, message: ProtoMessage,
185187
) -> None:
186188
array = value if isinstance(value, list) else value["val"]
187189
message.val.extend(array)

sdk/python/requirements/py3.7-ci-requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ mypy==0.931
400400
# via feast (setup.py)
401401
mypy-extensions==0.4.3
402402
# via mypy
403-
mypy-protobuf==3.1.0
403+
mypy-protobuf==3.1
404404
# via feast (setup.py)
405405
nbclient==0.5.11
406406
# via nbconvert
@@ -854,4 +854,4 @@ zipp==3.7.0
854854

855855
# The following packages are considered to be unsafe in a requirements file:
856856
# pip
857-
# setuptools
857+
# setuptools

sdk/python/setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"mmh3",
5353
"pandas>=1.0.0",
5454
"pandavro==1.5.*",
55-
"protobuf>=3.10",
55+
"protobuf>=3.10,<3.20",
5656
"proto-plus<1.19.7",
5757
"pyarrow>=4.0.0",
5858
"pydantic>=1.0.0",
@@ -111,7 +111,7 @@
111111
"mock==2.0.0",
112112
"moto",
113113
"mypy==0.931",
114-
"mypy-protobuf==3.1.0",
114+
"mypy-protobuf==3.1",
115115
"avro==1.10.0",
116116
"gcsfs",
117117
"urllib3>=1.25.4",
@@ -150,7 +150,7 @@
150150
+ GE_REQUIRED
151151
)
152152

153-
DEV_REQUIRED = ["mypy-protobuf>=3.1.0", "grpcio-testing==1.*"] + CI_REQUIRED
153+
DEV_REQUIRED = ["mypy-protobuf==3.1", "grpcio-testing==1.*"] + CI_REQUIRED
154154

155155
# Get git repo root directory
156156
repo_root = str(pathlib.Path(__file__).resolve().parent.parent.parent)
@@ -422,7 +422,7 @@ def run(self):
422422
"setuptools_scm",
423423
"grpcio",
424424
"grpcio-tools==1.34.0",
425-
"mypy-protobuf==3.1.0",
425+
"mypy-protobuf==3.1",
426426
"sphinx!=4.0.0",
427427
],
428428
package_data={

0 commit comments

Comments
 (0)