[cpp worker] support cluster mode (#9977)

This commit is contained in:
SongGuyang
2020-09-18 11:08:18 +08:00
committed by GitHub
parent 1b295a17cb
commit 5cbc411e38
27 changed files with 488 additions and 260 deletions
+4 -4
View File
@@ -85,7 +85,7 @@ class Ray {
#include "api/generated/create_actors.generated.h"
private:
static RayRuntime *runtime_;
static std::shared_ptr<RayRuntime> runtime_;
static std::once_flag is_inited_;
@@ -203,7 +203,7 @@ inline TaskCaller<ReturnType> Ray::TaskInternal(FuncType &func, ExecFuncType &ex
RemoteFunctionPtrHolder ptr;
ptr.function_pointer = reinterpret_cast<uintptr_t>(func);
ptr.exec_function_pointer = reinterpret_cast<uintptr_t>(exec_func);
return TaskCaller<ReturnType>(runtime_, ptr, buffer);
return TaskCaller<ReturnType>(runtime_.get(), ptr, buffer);
}
template <typename ActorType, typename FuncType, typename ExecFuncType,
@@ -217,7 +217,7 @@ inline ActorCreator<ActorType> Ray::CreateActorInternal(FuncType &create_func,
RemoteFunctionPtrHolder ptr;
ptr.function_pointer = reinterpret_cast<uintptr_t>(create_func);
ptr.exec_function_pointer = reinterpret_cast<uintptr_t>(exec_func);
return ActorCreator<ActorType>(runtime_, ptr, buffer);
return ActorCreator<ActorType>(runtime_.get(), ptr, buffer);
}
template <typename ReturnType, typename ActorType, typename FuncType,
@@ -233,7 +233,7 @@ inline ActorTaskCaller<ReturnType> Ray::CallActorInternal(FuncType &actor_func,
MemberFunctionPtrHolder holder = *(MemberFunctionPtrHolder *)(&actor_func);
ptr.function_pointer = reinterpret_cast<uintptr_t>(holder.value[0]);
ptr.exec_function_pointer = reinterpret_cast<uintptr_t>(exec_func);
return ActorTaskCaller<ReturnType>(runtime_, actor.ID(), ptr, buffer);
return ActorTaskCaller<ReturnType>(runtime_.get(), actor.ID(), ptr, buffer);
}
// TODO(barakmich): These includes are generated files that do not contain their
+8
View File
@@ -24,6 +24,14 @@ class RayConfig {
int node_manager_port = 62665;
std::string lib_name = "";
std::string store_socket = "";
std::string raylet_socket = "";
std::string session_dir = "";
static std::shared_ptr<RayConfig> GetInstance();
private:
+2 -2
View File
@@ -36,9 +36,9 @@ class RayRuntime {
virtual WaitResult Wait(const std::vector<ObjectID> &ids, int num_objects,
int timeout_ms) = 0;
virtual ObjectID Call(RemoteFunctionPtrHolder &fptr,
virtual ObjectID Call(const RemoteFunctionPtrHolder &fptr,
std::shared_ptr<msgpack::sbuffer> args) = 0;
virtual ActorID CreateActor(RemoteFunctionPtrHolder &fptr,
virtual ActorID CreateActor(const RemoteFunctionPtrHolder &fptr,
std::shared_ptr<msgpack::sbuffer> args) = 0;
virtual ObjectID CallActor(const RemoteFunctionPtrHolder &fptr, const ActorID &actor,
std::shared_ptr<msgpack::sbuffer> args) = 0;
@@ -0,0 +1,9 @@
#pragma once
namespace ray {
namespace api {
int default_worker_main(int argc, char **argv);
} // namespace api
} // namespace ray