-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Compare Python objects instead of proto objects #2227
Compare Python objects instead of proto objects #2227
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2227 +/- ##
==========================================
+ Coverage 84.92% 85.21% +0.28%
==========================================
Files 105 106 +1
Lines 8498 8568 +70
==========================================
+ Hits 7217 7301 +84
+ Misses 1281 1267 -14
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
sdk/python/feast/registry.py
Outdated
), | ||
feature_services=set(self.list_feature_services(project=project)), | ||
) | ||
|
||
# TODO(achals): This method needs to be filled out and used in the feast plan/apply methods. | ||
@staticmethod | ||
def diff_between( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method seems to logically belong as a method within RegistryDiff or something. You no longer are passing in registry protos at least
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my comment still loosely applies. We'll want to eventually do inferencing here as well to resolve the RepoContents to their exact registry form (e.g. including schema, inferred features in a FV, and feature projections in a feature service). A "diff" method to me seems to suggest a much simpler implementation than that.
Would also see this as belong in the same file as where we do inferencing, which I think technically is in feature_store.py
. That file is getting a bit large too though. We probably could use some sort of RepoContents -> Registry converter that does this inference logic for feast plan
and feast apply
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup this is fair - I moved this method to FcoDiff.py
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
sdk/python/feast/registry.py
Outdated
current_registry: RegistryProto, new_registry: RegistryProto | ||
) -> RegistryDiff: | ||
diff = RegistryDiff() | ||
def extract_objects_for_keep_delete_update_add( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems oddly placed here now. (also type annotations please)
I think the only place you call this is in repo_operations
and don't see any reason why other classes would ever call this, so maybe throw this there instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that this is also called in diff_between
, but still a fair point - it doesn't quite belong with the Registry, so I moved it to FcoDiff.py
sdk/python/feast/registry.py
Outdated
), | ||
feature_services=set(self.list_feature_services(project=project)), | ||
) | ||
|
||
# TODO(achals): This method needs to be filled out and used in the feast plan/apply methods. | ||
@staticmethod | ||
def diff_between( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my comment still loosely applies. We'll want to eventually do inferencing here as well to resolve the RepoContents to their exact registry form (e.g. including schema, inferred features in a FV, and feature projections in a feature service). A "diff" method to me seems to suggest a much simpler implementation than that.
Would also see this as belong in the same file as where we do inferencing, which I think technically is in feature_store.py
. That file is getting a bit large too though. We probably could use some sort of RepoContents -> Registry converter that does this inference logic for feast plan
and feast apply
sdk/python/feast/registry.py
Outdated
@@ -65,6 +66,16 @@ | |||
"": "LocalRegistryStore", | |||
} | |||
|
|||
REGISTRY_OBJECT_TYPE_TO_STR = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason why we can't use the original type name and need to remove the underscores?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want to convert plural -> single, so removing underscores doesn't quite do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.. this is because we use them directly in feast plan output to the console.
Mind making a comment explaining why this mapping exists? Also, it may make more sense to store this map closer to where it's used (i.e. near some feast plan file or in what today is repo_operations
)
sdk/python/feast/registry.py
Outdated
) | ||
|
||
objs_to_keep[object_type] = to_keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of having these mapped by object type? Seems like the caller of this immediately flattens it back into one big list. That also seems to introduce this need to look at REGISTRY_OBJECT_TYPES
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we map these by object type because diff_between
uses extract_objects_for_keep_delete_update_add
, and diff_between
needs to know the keep/delete/update/add split by object type in order to compare objects of the same type
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
d2e700d
to
ab2c9cb
Compare
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
/retest |
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
sdk/python/feast/registry.py
Outdated
@@ -65,6 +66,16 @@ | |||
"": "LocalRegistryStore", | |||
} | |||
|
|||
REGISTRY_OBJECT_TYPE_TO_STR = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.. this is because we use them directly in feast plan output to the console.
Mind making a comment explaining why this mapping exists? Also, it may make more sense to store this map closer to where it's used (i.e. near some feast plan file or in what today is repo_operations
)
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adchia, 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:
Approvers can indicate their approval by writing |
Signed-off-by: Felix Wang wangfelix98@gmail.com
What this PR does / why we need it: This PR switches
Registry.diff_between
and other helper methods to compare registry objects as Python objects instead of proto objects.Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: