Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add
*Record
ProtoBuf messages and corresponding serde functions. #2831Add
*Record
ProtoBuf messages and corresponding serde functions. #2831Changes from 4 commits
2864538
e8e0ef1
0299cb4
33b6368
1851032
c3b2b4b
53f421d
2f68a35
1368b30
673db0b
2b54a53
b226b61
1267d21
b61fbb4
5db284e
c161b7d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
MetricsRecord
only allowsint
andfloat
types (and lists of those two 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.
Yes, I get it.
I was thinking that, since we enforce type checks when instantiating the
MetricsRecord
, which means the data field inside must be valid, we can reuseValue
to store them to avoid having repetitive code in proto files and inserde.py
. But I also happy with copy-pasting part of the serde functions forValue
and create new messages forMetricsRecordValue
.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.
Got it, makes sense. I suspected that to be the case :)
My recommendation would be to create new messages that map closely to the Python code for two reasons:
Value
once we migrated everything toRecordSet
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.
ConfigsRecord
doesn't allowbool
yet. That's sth we should fix in a separate PR by adding it toConfigsRecord
.The more general question: should we define ProtoBuf messages that follow the same naming scheme as their Python dataclass counterpart?
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.
The reason for reusing
Value
instead of creating a new messageConfigsRecordValue
is the same as above (MetricsRecord
).Re: naming. IMO, we should use different names or even store them in a different way in a TaskIns. There's no benefits to keep them strictly equivalent. I think the ProtoBuf messages is aimed solely to transfer contents over the wire, which is different from the purpose of introducing record types. And hence I think we don't need to follow the same naming scheme and even don't need to have a counterpart for each dataclass record.
The advantage of not having counterparts is that we may not have to change protobuf messages and serde functions accordingly when we decide to modify our RecordSet. The disadvantage is that it's not easy to design a protobuf messages for general uses, and the naming will be less intuitive if we allow users to change protobuf messages in the future.
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 agree that we do not need to aim for a strict 1:1 mapping from Python to ProtoBuf.
I do think however that there is an advantage to keeping them close. As stated in the other comment, we want to implement Flower clients in languages other than Python. This usually starts with compiling existing ProtoBuf messages. If those messages are close to the Python level, it will be easier for others to implement the Java/C++/... counterpart.
In addition to that, it will maintenance of the Python client easier as well. In the case of
MetricsRecord
, for example, we would not need to check for unsupportedValue
types if we have aMetricsRecord
on the ProtoBuf level that supports the exact set of types that the PythonMetricsRecord
supports.Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.