Support multiple core workers in one process (#7623)

This commit is contained in:
Kai Yang
2020-04-07 11:01:47 +08:00
committed by GitHub
parent e91595f955
commit 48b48cc8c2
90 changed files with 2014 additions and 1411 deletions
+4 -9
View File
@@ -14,16 +14,14 @@ namespace streaming {
class ReaderClient {
public:
/// Construct a ReaderClient object.
/// \param[in] core_worker CoreWorker C++ pointer of current actor
/// \param[in] async_func DataReader's raycall function descriptor to be called by
/// DataWriter, asynchronous semantics \param[in] sync_func DataReader's raycall
/// function descriptor to be called by DataWriter, synchronous semantics
ReaderClient(CoreWorker *core_worker, RayFunction &async_func, RayFunction &sync_func)
: core_worker_(core_worker) {
ReaderClient(RayFunction &async_func, RayFunction &sync_func) {
DownstreamQueueMessageHandler::peer_async_function_ = async_func;
DownstreamQueueMessageHandler::peer_sync_function_ = sync_func;
downstream_handler_ = ray::streaming::DownstreamQueueMessageHandler::CreateService(
core_worker_, core_worker_->GetWorkerContext().GetCurrentActorID());
CoreWorkerProcess::GetCoreWorker().GetWorkerContext().GetCurrentActorID());
}
/// Post buffer to downstream queue service, asynchronously.
@@ -34,19 +32,17 @@ class ReaderClient {
std::shared_ptr<LocalMemoryBuffer> buffer);
private:
CoreWorker *core_worker_;
std::shared_ptr<DownstreamQueueMessageHandler> downstream_handler_;
};
/// Interface of streaming queue for DataWriter. Similar to ReaderClient.
class WriterClient {
public:
WriterClient(CoreWorker *core_worker, RayFunction &async_func, RayFunction &sync_func)
: core_worker_(core_worker) {
WriterClient(RayFunction &async_func, RayFunction &sync_func) {
UpstreamQueueMessageHandler::peer_async_function_ = async_func;
UpstreamQueueMessageHandler::peer_sync_function_ = sync_func;
upstream_handler_ = ray::streaming::UpstreamQueueMessageHandler::CreateService(
core_worker, core_worker_->GetWorkerContext().GetCurrentActorID());
CoreWorkerProcess::GetCoreWorker().GetWorkerContext().GetCurrentActorID());
}
void OnWriterMessage(std::shared_ptr<LocalMemoryBuffer> buffer);
@@ -54,7 +50,6 @@ class WriterClient {
std::shared_ptr<LocalMemoryBuffer> buffer);
private:
CoreWorker *core_worker_;
std::shared_ptr<UpstreamQueueMessageHandler> upstream_handler_;
};
} // namespace streaming