-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Serve] Add hash function of RunningReplicaInfo #32772
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -292,3 +292,26 @@ class RunningReplicaInfo: | |
actor_handle: ActorHandle | ||
max_concurrent_queries: int | ||
is_cross_language: bool = False | ||
|
||
def __post_init__(self): | ||
# Set hash value when object is constructed. | ||
# We use _acotor_id to hash the ActorHandle object | ||
sihanwang41 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# instead of actor_handle itself to make sure | ||
# it is consistently same actor handle between different | ||
# object ids. | ||
|
||
hash_val = hash( | ||
" ".join( | ||
[ | ||
self.deployment_name, | ||
self.replica_tag, | ||
str(self.actor_handle._actor_id), | ||
str(self.max_concurrent_queries), | ||
str(self.is_cross_language), | ||
] | ||
) | ||
) | ||
object.__setattr__(self, "_hash", hash_val) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For my education what's the benefit of this over There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh it is a hacky way to set attribute, since we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense! Would be good to put this in a code comment |
||
|
||
def __hash__(self): | ||
return self._hash |
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 test file wasn't running in CI before? 😮
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.
exactly...