From 9708ca560ec416f1c4161395316c50c1f8f1efeb Mon Sep 17 00:00:00 2001 From: "Zhanhao (Jasper) Liu" Date: Wed, 10 Jan 2018 01:27:49 +0800 Subject: [PATCH 1/2] fix some typos --- include/ps/internal/van.h | 4 ++-- src/van.cc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/ps/internal/van.h b/include/ps/internal/van.h index ce907763..e4cc9354 100644 --- a/include/ps/internal/van.h +++ b/include/ps/internal/van.h @@ -172,9 +172,9 @@ class Van { void ProcessBarrierCommand(Message* msg); /** - * \brief processing logic of AddNode message (run on each node) + * \brief processing logic of Heartbeat message (run on each node) */ - void ProcessHearbeat(Message* msg); + void ProcessHeartbeat(Message* msg); /** * \brief processing logic of Data message diff --git a/src/van.cc b/src/van.cc index ab44c59e..5e4238bb 100644 --- a/src/van.cc +++ b/src/van.cc @@ -14,8 +14,8 @@ #include "./resender.h" namespace ps { -// interval in second between to heartbeast signals. 0 means no heartbeat. -// don't send heartbeast in default. because if the scheduler received a +// interval in second between two heartbeast signals. 0 means no heartbeat. +// don't send heartbeat in default. because if the scheduler received a // heartbeart signal from a node before connected to that node, then it could be // problem. static const int kDefaultHeartbeatInterval = 0; @@ -155,7 +155,7 @@ void Van::UpdateLocalID(Message* msg, std::unordered_set* deadnodes_set, } } -void Van::ProcessHearbeat(Message* msg) { +void Van::ProcessHeartbeat(Message* msg) { auto& ctrl = msg->meta.control; time_t t = time(NULL); for (auto &node : ctrl.node) { @@ -401,7 +401,7 @@ void Van::Receiving() { } else if (ctrl.cmd == Control::BARRIER) { ProcessBarrierCommand(&msg); } else if (ctrl.cmd == Control::HEARTBEAT) { - ProcessHearbeat(&msg); + ProcessHeartbeat(&msg); } else { LOG(WARNING) << "Drop unknown typed message " << msg.DebugString(); } From 73909de4696fa21578f37b1f101e6db38b4057a2 Mon Sep 17 00:00:00 2001 From: "Zhanhao (Jasper) Liu" Date: Sun, 28 Jan 2018 22:56:38 +0800 Subject: [PATCH 2/2] remove redundant the is_scheduler_ condition is excluded by the if statement above --- src/van.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/van.cc b/src/van.cc index 5e4238bb..421fc30f 100644 --- a/src/van.cc +++ b/src/van.cc @@ -254,8 +254,7 @@ void Van::Start(int customer_id) { if (is_scheduler_) { my_node_ = scheduler_; } else { - auto role = is_scheduler_ ? Node::SCHEDULER : - (Postoffice::Get()->is_worker() ? Node::WORKER : Node::SERVER); + auto role = Postoffice::Get()->is_worker() ? Node::WORKER : Node::SERVER; const char *nhost = Environment::Get()->find("DMLC_NODE_HOST"); std::string ip; if (nhost) ip = std::string(nhost);