Skip to content
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][c++ worker]Add namespace support for c++ worker #26327

Merged
merged 8 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint, comments
  • Loading branch information
WangTaoTheTonic committed Jul 7, 2022
commit 879f869b101b3420dfa7ac9342dbaa8a52683c56
6 changes: 2 additions & 4 deletions cpp/include/ray/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ ray::internal::ActorCreator<PyActorClass> Actor(PyActorClass func);
ray::internal::ActorCreator<JavaActorClass> Actor(JavaActorClass func);

/// Get a handle to a named actor in current namespace.
/// Gets a handle to a named actor with the given name. The actor must have been created
/// with name specified.
/// The actor must have been created with name specified.
///
/// \param[in] actor_name The name of the named actor.
/// \return An ActorHandle to the actor if the actor of specified name exists or an
Expand All @@ -121,8 +120,7 @@ template <typename T>
boost::optional<ActorHandle<T>> GetActor(const std::string &actor_name);

/// Get a handle to a named actor in the given namespace.
/// Gets a handle to a named actor with the given name of the given namespace. The actor
/// must have been created with name specified.
/// The actor must have been created with name specified.
///
/// \param[in] actor_name The name of the named actor.
/// \param[in] namespace The namespace of the actor.
Expand Down
1 change: 1 addition & 0 deletions cpp/include/ray/api/ray_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class RayConfig {
// A specific flag for internal `default_worker`. Please don't use it in user code.
bool is_worker_ = false;

WangTaoTheTonic marked this conversation as resolved.
Show resolved Hide resolved
// A namespace is a logical grouping of jobs and named actors.
std::string ray_namespace = "";
};

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/ray/config_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void ConfigInternal::Init(RayConfig &config, int argc, char **argv) {
}
if (worker_type == WorkerType::DRIVER) {
ray_namespace =
config.ray_namespace.empty() ? generate_uuid_v4() : config.ray_namespace;
config.ray_namespace.empty() ? GenerateUUIDV4() : config.ray_namespace;
}
};

Expand Down
2 changes: 1 addition & 1 deletion python/ray/_private/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def init(
is true.
log_to_driver: If true, the output from all of the worker
processes on all nodes will be directed to the driver.
namespace: Namespace to use
namespace: A namespace is a logical grouping of jobs and named actors.
runtime_env: The runtime environment to use
for this job (see :ref:`runtime-environments` for details).
storage: [Experimental] Specify a URI for persistent cluster-wide storage.
Expand Down
10 changes: 5 additions & 5 deletions src/ray/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ inline int64_t current_sys_time_us() {
return mu_since_epoch.count();
}

static std::random_device rd;
static std::mt19937 gen(rd());
static std::uniform_int_distribution<> dis(0, 15);
static std::uniform_int_distribution<> dis2(8, 11);
inline std::string GenerateUUIDV4() {
static std::random_device rd;
static std::mt19937 gen(rd());
static std::uniform_int_distribution<> dis(0, 15);
static std::uniform_int_distribution<> dis2(8, 11);

inline std::string generate_uuid_v4() {
std::stringstream ss;
int i;
ss << std::hex;
Expand Down