mirror of
https://github.com/wassname/ray.git
synced 2026-07-29 11:26:04 +08:00
[Core] Allow to pass node ip address to gcs server. (#10946)
* Allow to pass node ip address to gcs server. * Fix. * Addressed code review. * Fixed an error. * Addressed code review.
This commit is contained in:
@@ -252,11 +252,13 @@ std::unique_ptr<GcsObjectManager> GcsServer::InitObjectManager() {
|
||||
}
|
||||
|
||||
void GcsServer::StoreGcsServerAddressInRedis() {
|
||||
std::string address =
|
||||
GetValidLocalIp(
|
||||
GetPort(),
|
||||
RayConfig::instance().internal_gcs_service_connect_wait_milliseconds()) +
|
||||
":" + std::to_string(GetPort());
|
||||
std::string ip = config_.node_ip_address;
|
||||
if (ip.empty()) {
|
||||
ip = GetValidLocalIp(
|
||||
GetPort(),
|
||||
RayConfig::instance().internal_gcs_service_connect_wait_milliseconds());
|
||||
}
|
||||
std::string address = ip + ":" + std::to_string(GetPort());
|
||||
RAY_LOG(INFO) << "Gcs server address = " << address;
|
||||
|
||||
RAY_CHECK_OK(redis_gcs_client_->primary_context()->RunArgvAsync(
|
||||
|
||||
@@ -34,6 +34,7 @@ struct GcsServerConfig {
|
||||
uint16_t redis_port = 6379;
|
||||
bool retry_redis = true;
|
||||
bool is_test = false;
|
||||
std::string node_ip_address;
|
||||
};
|
||||
|
||||
class GcsNodeManager;
|
||||
|
||||
@@ -27,6 +27,7 @@ DEFINE_int32(metrics_agent_port, -1, "The port of metrics agent.");
|
||||
DEFINE_string(config_list, "", "The config list of raylet.");
|
||||
DEFINE_string(redis_password, "", "The password of redis.");
|
||||
DEFINE_bool(retry_redis, false, "Whether we retry to connect to the redis.");
|
||||
DEFINE_string(node_ip_address, "", "The ip address of the node.");
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
InitShutdownRAII ray_log_shutdown_raii(ray::RayLog::StartRayLog,
|
||||
@@ -42,6 +43,7 @@ int main(int argc, char *argv[]) {
|
||||
const std::string config_list = FLAGS_config_list;
|
||||
const std::string redis_password = FLAGS_redis_password;
|
||||
const bool retry_redis = FLAGS_retry_redis;
|
||||
const std::string node_ip_address = FLAGS_node_ip_address;
|
||||
gflags::ShutDownCommandLineFlags();
|
||||
|
||||
std::unordered_map<std::string, std::string> config_map;
|
||||
@@ -75,6 +77,7 @@ int main(int argc, char *argv[]) {
|
||||
gcs_server_config.redis_port = redis_port;
|
||||
gcs_server_config.redis_password = redis_password;
|
||||
gcs_server_config.retry_redis = retry_redis;
|
||||
gcs_server_config.node_ip_address = node_ip_address;
|
||||
ray::gcs::GcsServer gcs_server(gcs_server_config, main_service);
|
||||
|
||||
// Destroy the GCS server on a SIGTERM. The pointer to main_service is
|
||||
|
||||
Reference in New Issue
Block a user