-
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
[Core] Rename ClientFactoryFn to CoreWorkerClientFactoryFn #48576
Changes from all 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 |
---|---|---|
|
@@ -417,6 +417,8 @@ class ObjectRefGenerator: | |
return False | ||
else: | ||
return True | ||
else: | ||
return False | ||
|
||
""" | ||
Private APIs | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,6 @@ | |
#include "ray/common/id.h" | ||
#include "ray/rpc/worker/core_worker_client.h" | ||
|
||
using absl::optional; | ||
using std::shared_ptr; | ||
|
||
namespace ray { | ||
namespace rpc { | ||
|
||
|
@@ -35,13 +32,13 @@ class CoreWorkerClientPool { | |
: client_factory_(defaultClientFactory(ccm)){}; | ||
|
||
/// Creates a CoreWorkerClientPool by a given connection function. | ||
CoreWorkerClientPool(ClientFactoryFn client_factory) | ||
CoreWorkerClientPool(CoreWorkerClientFactoryFn client_factory) | ||
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.
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. Will fix in my next PR |
||
: client_factory_(client_factory){}; | ||
|
||
/// Returns an open CoreWorkerClientInterface if one exists, and connect to one | ||
/// if it does not. The returned pointer is borrowed, and expected to be used | ||
/// briefly. | ||
shared_ptr<CoreWorkerClientInterface> GetOrConnect(const Address &addr_proto); | ||
std::shared_ptr<CoreWorkerClientInterface> GetOrConnect(const Address &addr_proto); | ||
|
||
/// Removes a connection to the worker from the pool, if one exists. Since the | ||
/// shared pointer will no longer be retained in the pool, the connection will | ||
|
@@ -59,7 +56,7 @@ class CoreWorkerClientPool { | |
/// Provides the default client factory function. Providing this function to the | ||
/// construtor aids migration but is ultimately a thing that should be | ||
/// deprecated and brought internal to the pool, so this is our bridge. | ||
ClientFactoryFn defaultClientFactory(rpc::ClientCallManager &ccm) const { | ||
CoreWorkerClientFactoryFn defaultClientFactory(rpc::ClientCallManager &ccm) const { | ||
return [&](const rpc::Address &addr) { | ||
return std::shared_ptr<rpc::CoreWorkerClient>(new rpc::CoreWorkerClient(addr, ccm)); | ||
}; | ||
|
@@ -76,19 +73,19 @@ class CoreWorkerClientPool { | |
/// This factory function does the connection to CoreWorkerClient, and is | ||
/// provided by the constructor (either the default implementation, above, or a | ||
/// provided one) | ||
ClientFactoryFn client_factory_; | ||
CoreWorkerClientFactoryFn client_factory_; | ||
|
||
absl::Mutex mu_; | ||
|
||
struct CoreWorkerClientEntry { | ||
public: | ||
CoreWorkerClientEntry() {} | ||
CoreWorkerClientEntry(ray::WorkerID worker_id, | ||
shared_ptr<CoreWorkerClientInterface> core_worker_client) | ||
std::shared_ptr<CoreWorkerClientInterface> core_worker_client) | ||
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. Can be moved? 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. Will fix in my next PR |
||
: worker_id(worker_id), core_worker_client(core_worker_client) {} | ||
|
||
ray::WorkerID worker_id; | ||
shared_ptr<CoreWorkerClientInterface> core_worker_client; | ||
std::shared_ptr<CoreWorkerClientInterface> core_worker_client; | ||
}; | ||
|
||
/// A list of open connections from the most recent accessed to the least recent | ||
|
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.
Oh my....