From 86aff73850ab9cf933cd74cada2ae1a84da2c539 Mon Sep 17 00:00:00 2001 From: zhangbin Date: Wed, 28 Feb 2018 19:22:43 +0800 Subject: [PATCH] modify the way of get host ip --- src/van.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/van.cc b/src/van.cc index ab44c59e..19b8da2d 100644 --- a/src/van.cc +++ b/src/van.cc @@ -253,6 +253,16 @@ void Van::Start(int customer_id) { // get my node info if (is_scheduler_) { my_node_ = scheduler_; + std::string ip; + const char *itf = Environment::Get()->find("DMLC_INTERFACE"); + std::string interface; + if (itf) interface = std::string(itf); + if (interface.size()) { + GetIP(interface, &ip); + } else { + GetAvailableInterfaceAndIP(&interface, &ip); + } + my_node_.hostname = ip; } else { auto role = is_scheduler_ ? Node::SCHEDULER : (Postoffice::Get()->is_worker() ? Node::WORKER : Node::SERVER);