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
  • Loading branch information
WangTaoTheTonic committed Jul 7, 2022
commit 1eb5e49ab80fbeef5ca2dd3c0361228cbef4054c
2 changes: 1 addition & 1 deletion cpp/include/ray/api/ray_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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
std::string ray_namespace = "";
};

Expand Down
3 changes: 2 additions & 1 deletion cpp/src/ray/config_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ 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;
ray_namespace =
config.ray_namespace.empty() ? generate_uuid_v4() : config.ray_namespace;
}
};

Expand Down
48 changes: 24 additions & 24 deletions src/ray/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,30 +123,30 @@ static std::uniform_int_distribution<> dis(0, 15);
static std::uniform_int_distribution<> dis2(8, 11);

inline std::string generate_uuid_v4() {
WangTaoTheTonic marked this conversation as resolved.
Show resolved Hide resolved
std::stringstream ss;
int i;
ss << std::hex;
for (i = 0; i < 8; i++) {
ss << dis(gen);
}
ss << "-";
for (i = 0; i < 4; i++) {
ss << dis(gen);
}
ss << "-4";
for (i = 0; i < 3; i++) {
ss << dis(gen);
}
ss << "-";
ss << dis2(gen);
for (i = 0; i < 3; i++) {
ss << dis(gen);
}
ss << "-";
for (i = 0; i < 12; i++) {
ss << dis(gen);
};
return ss.str();
std::stringstream ss;
int i;
ss << std::hex;
for (i = 0; i < 8; i++) {
ss << dis(gen);
}
ss << "-";
for (i = 0; i < 4; i++) {
ss << dis(gen);
}
ss << "-4";
for (i = 0; i < 3; i++) {
ss << dis(gen);
}
ss << "-";
ss << dis2(gen);
for (i = 0; i < 3; i++) {
ss << dis(gen);
}
ss << "-";
for (i = 0; i < 12; i++) {
ss << dis(gen);
};
return ss.str();
}

/// A helper function to parse command-line arguments in a platform-compatible manner.
Expand Down