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
Message interface is hidden inside function call #301
base: master
Are you sure you want to change the base?
Message interface is hidden inside function call #301
Changes from 1 commit
560098c
a84b93c
05c36fa
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.
I don't understand this change 🤔 MESSAGE_KEY is imported and passed as key, why is that?
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.
It is basically the same as previous test. The previous one build the
msg
which is a dict and I use it to assert. Now, the msg is not build, so I directly compare themsg_text
. The different here is with new change, theproc.kill
only require passing themsg_text
, rather than construct the message type first.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.
As we discussed in the office, let's make it this way:
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.
@khsrali also prefer having directly using
proc.killed_msg()['message']
which I don't agree with both.I agree with changing the name to
MESSAGE_TEXT_KEY
can be a bit more clear. But I don't like putting this as a class attribute.@sphuber what you think? It is mostly a matter of taste and we need the third one to settle 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.
The point is, why should these keys be outside of the only class that defines them? they are defined as
MessageBuilder
keys.whilst you could:
or even:
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 think this is not good since the typo in the str won't be checked by the pre-commit or modern IDE. Meanwhile, we did struggle a lot by that the exception from plumpy is not well propagated to the aiida log which makes such error even hard to find and debug. Usually such exception can cause the test in aiida-core hang up rather than raising exceptions.
mb
can be quite confuse, it looks more like megabytes from first glimpse.The proper solution will be defining in
plumpy.process_comms
a standard message protocol and hasing message defined as a dataclass then used in plumpy and se/de -serialize the message through for example msgpack. It is a generic pattern, which can be found such as in redis or bit-torrent.But change the message to dataclass require also change the de/se function which is beyond the scope of this PR.
TBH, I think this is a very small problem and only the matter of taste. As you can see from https://github.com/aiidateam/aiida-core/pull/6668/files, the
MESSAGE_TEXT_KEY
is not used there but only in plumpy, it defined as a part of message protocol of current design (which using dict as the message body).