-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Use strongly typed IDs in C++. #4185
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
Conversation
|
Test FAILed. |
python/ray/includes/unique_ids.pxi
Outdated
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.
Do we really want to allocate this on the heap? Seems like for such a small object it would be better to do it inline, can that be made to work?
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 removed all the heap allocations.
|
The C++ changes are great, for the cython ones, is there a way to get rid of the heap allocations (and also the code duplications if possible). |
|
This is a huge improvement. I've had plenty of bugs in the past where I mixed up the ID types (e.g., passed ID arguments into a function in the wrong order) that would have been caught by this. |
|
This should fix #3721, right? |
|
@robertnishihara Yes, that will fix #3721 . |
178fcba to
a880709
Compare
|
Test PASSed. |
|
Test PASSed. |
|
Test FAILed. |
|
@AmplabJenkins retest this, please. |
|
Test FAILed. |
|
@AmplabJenkins retest this, please. |
|
Test FAILed. |
python/ray/includes/unique_ids.pxi
Outdated
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.
Can this be invoked in a situation where self is not of type ObjectID?
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.
Maybe this is only useful in __cinit__ and it is not necessary in __init__. I will do a double confirm. For __cinit__, the functions of derived class and base class will both be called, so using this if statement will avoid duplicated initiation.
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.
@pcmoritz In cython, __init__ behaves the same as python's. This function will be called only once. On the contrast, __cinit__ will be called in both base class and derived class. I have removed the type check. Thanks!
|
Test FAILed. |
|
Test FAILed. |
|
Test FAILed. |
|
Test FAILed. |
python/ray/includes/unique_ids.pxd
Outdated
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 seems that these constructors aren't used in Cython. We can remove them to minimize redundant code.
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 removed both constructors for each cppclass.
|
Test FAILed. |
|
Do you have more comments? I rebased the PR every day avoid logic conflicts with other PRs. |
pcmoritz
left a comment
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 is great!
|
Test FAILed. |
What do these changes do?
Related issue number
#3721