| 226 | } |
| 227 | |
| 228 | Status PrefetchRunnerMgr::StartRunners(std::string graph_key, Session* sess) { |
| 229 | if (register_runner_options_.count(graph_key) == 0) |
| 230 | return Status( |
| 231 | errors::NotFound("graph <" + graph_key + "> has no PrefetchRunner")); |
| 232 | |
| 233 | if (prefetch_runners_.count(sess) != 0) |
| 234 | return Status(errors::AlreadyExists( |
| 235 | "PrefetchRunners has already started in Session.")); |
| 236 | |
| 237 | // Create and Start the PrefetchRunners. |
| 238 | coords_[sess].reset(new Coordinator()); |
| 239 | |
| 240 | for (auto option : register_runner_options_[graph_key]) { |
| 241 | std::unique_ptr<PrefetchRunner> runner(new PrefetchRunner( |
| 242 | graph_key, option.first, sess, coords_[sess].get(), option.second)); |
| 243 | prefetch_runners_[sess].insert(runner.get()); |
| 244 | coords_[sess]->RegisterRunner(std::move(runner)); |
| 245 | } |
| 246 | |
| 247 | for (auto runner : prefetch_runners_[sess]) |
| 248 | runner->Start(); |
| 249 | |
| 250 | return Status::OK(); |
| 251 | } |
| 252 | |
| 253 | Status PrefetchRunnerMgr::StopRunners(std::string graph_key, Session* sess) { |
| 254 | if (prefetch_runners_.count(sess) == 0) |
no test coverage detected