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
[core worker] Refactor CoreWorker member classes #5062
[core worker] Refactor CoreWorker member classes #5062
Conversation
cc @raulchen @jovany-wang @zhijunfu, please let me know if these changes don't align with what you guys are thinking! |
Test PASSed. |
Test FAILed. |
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.
Looks good to me, thanks for the effort. I left a few minor comments.
/// Information about a remote function. | ||
struct RayFunction { | ||
/// Language of the remote function. | ||
const WorkerLanguage language; | ||
const Language language; |
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 original intent of having a WorkerLanguage
structure is that users don't need to look at the generated protobuf file for the Language
definition, as that generated .h
file is complex so we want to hide that complexity. But yes I agree that using Language
directly makes the core worker code simpler, probably that's the right thing to do. Maybe we can consider separating Language
definition to a different protobuf file say common.proto
?
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, yes, I think having a single Language
type is cleaner. Sure, should I move Language
to a new protobuf file now?
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.
never mind, I could take care of it in my next PR:)
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.
FYI, I'm working on common.proto
right now.
// TODO(zhijunfu): currently RayletClient would crash in its constructor if it cannot | ||
// connect to Raylet after a number of retries, this needs to be changed | ||
// so that the worker (java/python .etc) can retrieve and handle the error | ||
// instead of crashing. |
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 comment actually refers to RayletClient
, and should better be moved to CoreWorker where raylet_client_
is initialized?
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.
Sure, thanks!
Test FAILed. |
Test FAILed. |
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. thanks.
@stephanie-wang There is a compile error in one of the tests, do you want to fix it?
|
I'm actually in favor of having the CoreWorker and the sub interfaces friend each other. Because the public methods in these interfaces are supposed to exposed to Java/Python workers and should be limited. And on the other hand, inside these interfaces, we sometimes want to use other interfaces' private methods. E.g., The initial reason why we split Does this make sense? |
Sorry, I don't understand your example about the In general, I just want to avoid giving classes access to private fields that they are not currently using; for example, before this PR, the |
Test PASSed. |
@stephanie-wang Initially, I was thinking that all the sub interfaces would intensively use other interfaces' private methods. After thinking more, this doesn't seem true. I think what you said should be better. Only use friend in particular classes that need it. Thanks. |
@stephanie-wang there's still a compile error, may you please fix it? There are a few such places in
|
Oops, thank you! |
Test PASSed. |
FYI, I changed type of language to |
Thanks, I changed it to just use |
Test FAILed. |
Test FAILed. |
Test FAILed. |
Test FAILed. |
What do these changes do?
Refactoring
CoreWorker
class to encapsulate functionality a bit more. Removes references to the parentCoreWorker
from theCoreWorkerObjectInterface
,CoreWorkerTaskInterface
, andCoreWorkerTaskExecutionInterface
.Linter
scripts/format.sh
to lint the changes in this PR.