| 158 | } |
| 159 | |
| 160 | void Postoffice::stop() { |
| 161 | if (IamScheduler()) { |
| 162 | if (FLAGS_num_workers + FLAGS_num_servers) { |
| 163 | nodes_are_done_.get_future().wait(); |
| 164 | } |
| 165 | Task terminate; |
| 166 | terminate.set_type(Task::TERMINATE); |
| 167 | app_->port(kLiveGroup)->submit(terminate); |
| 168 | usleep(800); |
| 169 | LI << "System stopped\n"; |
| 170 | } else { |
| 171 | Task done; |
| 172 | done.set_type(Task::MANAGE); |
| 173 | done.mutable_mng_app()->set_cmd(ManageApp::DONE); |
| 174 | app_->port(app_->schedulerID())->submit(done); |
| 175 | // run as a daemon until received the termination messag |
| 176 | while (!done_) usleep(300); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | void Postoffice::reply( |
| 181 | const NodeID& recver, const Task& task, const string& reply_msg) { |
nothing calls this directly
no test coverage detected