Skip to content
New issue

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

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

Already on GitHub? # to your account

Add an interface for TransformationService and a basic implementation #1932

Merged
merged 13 commits into from
Oct 14, 2021

Conversation

achals
Copy link
Member

@achals achals commented Oct 11, 2021

Signed-off-by: Achal Shah achals@gmail.com

What this PR does / why we need it:

Working Example:

$ grpcurl -plaintext  -d '{"transformation_name": "conv_rate_plus_100"}' localhost:6569 feast.serving.TransformationService/TransformFeatures
{
  "transformation_output": {
    "arrow_value": "QVJST1cxAAD/////iAIAABAAAAAAAAoADgAGAAUACAAKAAAAAAEEABAAAAAAAAoADAAAAAQACAAKAAAAAAIAAAQAAAABAAAADAAAAAgADAAEAAgACAAAANgBAAAEAAAAywEAAHsiaW5kZXhfY29sdW1ucyI6IFt7ImtpbmQiOiAicmFuZ2UiLCAibmFtZSI6IG51bGwsICJzdGFydCI6IDAsICJzdG9wIjogMSwgInN0ZXAiOiAxfV0sICJjb2x1bW5faW5kZXhlcyI6IFt7Im5hbWUiOiBudWxsLCAiZmllbGRfbmFtZSI6IG51bGwsICJwYW5kYXNfdHlwZSI6ICJ1bmljb2RlIiwgIm51bXB5X3R5cGUiOiAib2JqZWN0IiwgIm1ldGFkYXRhIjogeyJlbmNvZGluZyI6ICJVVEYtOCJ9fV0sICJjb2x1bW5zIjogW3sibmFtZSI6ICJjb252X3JhdGVfcGx1c18xMDAiLCAiZmllbGRfbmFtZSI6ICJjb252X3JhdGVfcGx1c18xMDAiLCAicGFuZGFzX3R5cGUiOiAiZmxvYXQ2NCIsICJudW1weV90eXBlIjogImZsb2F0NjQiLCAibWV0YWRhdGEiOiBudWxsfV0sICJjcmVhdG9yIjogeyJsaWJyYXJ5IjogInB5YXJyb3ciLCAidmVyc2lvbiI6ICI1LjAuMCJ9LCAicGFuZGFzX3ZlcnNpb24iOiAiMS4zLjEifQAGAAAAcGFuZGFzAAABAAAAFAAAABAAF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4zLjEifQAGAAAAcGFuZGFzAAABAAAAFAAAABAAFAAIAAYABwAMAAAAEAAQAAAAAAABAxAAAAAsAAAABAAAAAAAAAASAAAAY29udl9yYXRlX3BsdXNfMTAwAAAAAAYACAAGAAYAAAAAAAIAsAIAAEFSUk9XMQ=="
  }
}

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:


@feast-ci-bot
Copy link
Collaborator

@achals: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@@ -423,6 +423,20 @@ def serve_command(ctx: click.Context, port: int):
store.serve(port)


@cli.command("serve_transformations")
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to use a different serving (compared to just serve)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just so that the transformation server can be started up separately from the feature server. I can collapse in a single command if that'd be simpler

Copy link
Member

Choose a reason for hiding this comment

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

Personally I like the idea of rolling it into a single server so that users don't need to run multiple servers during dev.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we do want the option though because this is also intended to work standalone when users deploy to higher scale? during dev users probably don't need an FTS at all since it's covered during the regular get_online_features flow?

could see that we expose a debug endpoint but that seems slightly different

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to stick to a separate command and we can revisit if it becomes too cumbersome during dev cycles, unless anyone feels strongly.

@achals achals changed the title Add an interface for TransformationService, along with a basic implem… Add an interface for TransformationService and a basic implementation Oct 11, 2021
@achals achals force-pushed the achal/transformation-service branch from a0a0216 to 26ef01c Compare October 11, 2021 21:57
Copy link
Collaborator

@adchia adchia left a comment

Choose a reason for hiding this comment

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

generally lgtm!


message GetTransformationServiceInfoRequest {}

message GetTransformationServiceInfoResponse {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this makes sense for the most advanced user.

for a user just getting started, i'd want maybe an "EMBEDDED" mode too where transformations happen on the feature server itself?

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean in the python feature server, right? How would that be different from just running get_online_features pointing to a python feature server API, which should look up the values and do the transformation?

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe the earlier question is what is the BATCH or ONLINE mode used for? seems like in both cases, we're applying the same row-level udf to all values?

string transformation_name = 1;
string project = 2;

ValueType transformation_input = 3;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Assuming that this input is WIP? since you call .arrow_value below on this, which ValueType doesn't have.

Are you envisioning the FTS would communicate with the registry? My preference is probably to start without to have as many stateless servers as possible

Copy link
Collaborator

Choose a reason for hiding this comment

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

unless of course we run into performance issues, in which case having a cached registry would be needed

Copy link
Member Author

Choose a reason for hiding this comment

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

It would have to get the registry at least once because that's how it would unpickle the transformations, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

hm yeah it needs the udf definition which we currently store in the FTS.

no strong feelings. an alternative would be to pass the udf directly in the request so the FTS becomes purely about execution. though at that point, we may consider using a ray cluster directly instead of managing an FTS.

If both this and the FTS can pull the registry, wondering if there can now be synchronization issues where e.g. a feature server that calls into this has a different version of the registry than what is on the FTS.

Copy link
Member Author

Choose a reason for hiding this comment

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

Passing in the UDF seems like a performance and dependency nightmare - I think we should stick with a simple approach for now assuming access to the registry. If we don't want to do that then yea we can farm out to a ray cluster from the client directly.

Re: sync issues, i think it's possible, but I don't know if we want to solve that problem now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sgtm for the first cut

unclear imo though whether udf passing would be more complex.
e.g .the dependency issues we'd run into today anyways on the regular feature server no?
e.g. performance here referring to payload increases causing issues? payload size isn't really directly correlated with network latency, and it probably will be relatively negligible esp if users are passing in large sets of entity keys.

@codecov-commenter
Copy link

codecov-commenter commented Oct 12, 2021

Codecov Report

Merging #1932 (9a21fa2) into master (cd0e0e0) will decrease coverage by 0.31%.
The diff coverage is 39.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1932      +/-   ##
==========================================
- Coverage   82.26%   81.94%   -0.32%     
==========================================
  Files          96       97       +1     
  Lines        7669     7727      +58     
==========================================
+ Hits         6309     6332      +23     
- Misses       1360     1395      +35     
Flag Coverage Δ
integrationtests 74.07% <37.50%> (-0.09%) ⬇️
unittests 59.24% <39.65%> (-0.14%) ⬇️

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

Impacted Files Coverage Δ
sdk/python/feast/repo_config.py 78.97% <ø> (ø)
sdk/python/feast/feature_store.py 93.30% <25.00%> (-1.25%) ⬇️
sdk/python/feast/transformation_server.py 40.47% <40.47%> (ø)
sdk/python/feast/cli.py 39.00% <50.00%> (+0.30%) ⬆️
sdk/python/feast/infra/utils/aws_utils.py 71.01% <0.00%> (-0.73%) ⬇️
sdk/python/tests/conftest.py 95.31% <0.00%> (+1.56%) ⬆️

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 cd0e0e0...9a21fa2. Read the comment docs.

@achals achals marked this pull request as ready for review October 13, 2021 19:22
@achals achals requested review from felixwang9817, tsotnet and a team as code owners October 13, 2021 19:22
// Feast version of this transformation service deployment.
string version = 1;

// Type of serving deployment, either ONLINE or BATCH. Different store types support different
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure what this comment means - ONLINE and BATCH also don't match up with the TransformationServiceType options below?

@@ -76,6 +76,19 @@ class RegistryConfig(FeastBaseModel):
expire. Users can manually refresh the cache by calling feature_store.refresh_registry() """


class TransformationServerConfig(FeastBaseModel):
"""Server Configuration that determines to how the transformation server is configured."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: "determines how"



class ServerConfig(FeastBaseModel):
"""Server Configuration that determines to how feast servers are configured. """
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: same as above

@@ -175,6 +194,11 @@ def _validate_online_store_config(cls, values):
[ErrorWrapper(e, loc="online_store")], model=RepoConfig,
)

if "servers" not in values:
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we're validating servers here, shouldn't we have a separate validate_servers_config function?

context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
raise

assert odfv
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: throw an exception instead of assert

Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
@achals achals force-pushed the achal/transformation-service branch from 148dadc to 2a73ae7 Compare October 14, 2021 21:13
Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
Signed-off-by: Achal Shah <achals@gmail.com>
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.

/lgtm

@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [achals,felixwang9817]

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

@felixwang9817
Copy link
Collaborator

/kind feature

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants