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

chore: Use Go-based implementation as embedded extension to Python SDK #2429

Merged
merged 10 commits into from
Mar 24, 2022

Conversation

pyalex
Copy link
Collaborator

@pyalex pyalex commented Mar 21, 2022

What this PR does / why we need it:

Converts Go-based implementation of get online features functionality into library which will be embedded into Python code and called directly from Python SDK (w/o GRPC in the middle). This allows us to also use Python functions as callbacks to call some implementations (like online/offline store connectors) from Go feature server.

Which issue(s) this PR fixes:

Fixes #

@pyalex pyalex requested a review from a team as a code owner March 21, 2022 22:57
@pyalex pyalex requested review from achals and removed request for a team March 21, 2022 22:57
Makefile Outdated Show resolved Hide resolved
go/utils/typeconversion.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2022

Codecov Report

Merging #2429 (5f97c4b) into master (ea6a9b2) will increase coverage by 1.06%.
The diff coverage is 93.50%.

@@            Coverage Diff             @@
##           master    #2429      +/-   ##
==========================================
+ Coverage   83.66%   84.73%   +1.06%     
==========================================
  Files         125      126       +1     
  Lines       10838    10811      -27     
==========================================
+ Hits         9068     9161      +93     
+ Misses       1770     1650     -120     
Flag Coverage Δ
integrationtests 74.73% <93.50%> (+1.45%) ⬆️
unittests 58.39% <25.00%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sdk/python/tests/conftest.py 91.26% <ø> (+12.39%) ⬆️
...ts/integration/feature_repos/repo_configuration.py 96.07% <ø> (-0.03%) ⬇️
sdk/python/feast/feature_store.py 91.56% <85.71%> (+0.72%) ⬆️
.../integration/online_store/test_universal_online.py 93.31% <88.88%> (+22.25%) ⬆️
...ython/feast/embedded_go/online_features_service.py 95.08% <95.08%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea6a9b2...5f97c4b. Read the comment docs.

Copy link
Collaborator

@felixwang9817 felixwang9817 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pyalex some preliminary comments; will continue reviewing

go/utils/typeconversion.go Outdated Show resolved Hide resolved
go/internal/feast/featurestore.go Outdated Show resolved Hide resolved
go/internal/feast/featurestore.go Show resolved Hide resolved
go/internal/feast/featurestore.go Show resolved Hide resolved
go/internal/feast/featurestore.go Show resolved Hide resolved
go/internal/feast/featurestore.go Outdated Show resolved Hide resolved
go/internal/feast/featurestore.go Outdated Show resolved Hide resolved
@pyalex pyalex force-pushed the embedded-go branch 2 times, most recently from 1231226 to 301abe6 Compare March 22, 2022 22:48
sdk/python/feast/embedded_go/online_features_service.py Outdated Show resolved Hide resolved
go/utils/typeconversion.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@felixwang9817 felixwang9817 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more comments, will continue looking

Makefile Show resolved Hide resolved
go/cmd/server/server.go Show resolved Hide resolved
go/internal/feast/featurestore_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@felixwang9817 felixwang9817 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more comments

sdk/python/tests/conftest.py Show resolved Hide resolved
sdk/python/feast/feature_store.py Show resolved Hide resolved
if err != nil {
log.Fatalln(err)
}
defer fs.DestructOnlineStore()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this called immediately since we're returning in the next line? What's the value of deferring it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

go/internal/feast/featurestore_test.go Show resolved Hide resolved
Comment on lines 50 to 71
schema = pa.schema(entity_fields)
batch = pa.RecordBatch.from_arrays(entity_arrays, schema=schema)

out_c_schema = ffi.new("struct ArrowSchema*")
out_ptr_schema = int(ffi.cast("uintptr_t", out_c_schema))

out_c_array = ffi.new("struct ArrowArray*")
out_ptr_array = int(ffi.cast("uintptr_t", out_c_array))

in_c_schema = ffi.new("struct ArrowSchema*")
in_ptr_schema = int(ffi.cast("uintptr_t", in_c_schema))

in_c_array = ffi.new("struct ArrowArray*")
in_ptr_array = int(ffi.cast("uintptr_t", in_c_array))

schema._export_to_c(in_ptr_schema)
batch._export_to_c(in_ptr_array)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments here would be nice

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
@pyalex
Copy link
Collaborator Author

pyalex commented Mar 23, 2022

@achals @felixwang9817 Addressed your comments.

Copy link
Collaborator

@felixwang9817 felixwang9817 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm comfortable with merging in this PR now; I'll let @achals have the final say

thanks @pyalex for addressing my comments!

go/cmd/server/server.go Show resolved Hide resolved
Copy link
Member

@achals achals left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks mostly fine, but the biggest piece is the featurestore.go file which I don't think I have confidence that I've reviewed thoroughly. I'll take a pass over that tomorrow morning.

Makefile Outdated
go mod tidy
go build -o ${ROOT_DIR}/sdk/python/feast/binaries/server github.com/feast-dev/feast/go/cmd/server
compile-go-lib: install-go-proto-dependencies install-go-ci-dependencies
python -m install pybindgen
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be python -m pip install pybindgen? And should we pin the version of pybindgen?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is embarrassing) fixed

Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
currentVector.Values = builder.NewArray()
} else {
currentVector.Values = array.NewNull(numRows)
arrowValues, err := utils.ProtoValuesToArrowArray(protoValues, arrowAllocator, numRows)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, can we have a different module name instead of utils? Seems like it'll become a kitchen sink..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed into types since it's type utils

Copy link
Member

@achals achals left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: achals, pyalex

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
@feast-ci-bot feast-ci-bot removed the lgtm label Mar 24, 2022
Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
@achals
Copy link
Member

achals commented Mar 24, 2022

/lgtm

@feast-ci-bot feast-ci-bot merged commit 0fbc062 into feast-dev:master Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants