| 201 | } |
| 202 | |
| 203 | void received(const Event& event) |
| 204 | { |
| 205 | LOG(INFO) << "Received " << event.type() << " event"; |
| 206 | |
| 207 | switch (event.type()) { |
| 208 | case Event::SUBSCRIBED: { |
| 209 | LOG(INFO) << "Subscribed executor on " |
| 210 | << event.subscribed().slave_info().hostname(); |
| 211 | |
| 212 | frameworkInfo = event.subscribed().framework_info(); |
| 213 | state = SUBSCRIBED; |
| 214 | |
| 215 | CHECK(event.subscribed().has_container_id()); |
| 216 | executorContainerId = event.subscribed().container_id(); |
| 217 | |
| 218 | // It is possible that the agent process had failed after we |
| 219 | // had launched the child containers. We can resume waiting on the |
| 220 | // child containers again. |
| 221 | if (!containers.empty()) { |
| 222 | wait(containers.keys()); |
| 223 | } |
| 224 | |
| 225 | // Resume all checks and health checks. |
| 226 | foreachvalue (Owned<Container>& container, containers) { |
| 227 | if (container->checker.isSome()) { |
| 228 | container->checker->get()->resume(); |
| 229 | } |
| 230 | |
| 231 | if (container->healthChecker.isSome()) { |
| 232 | container->healthChecker->get()->resume(); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | break; |
| 237 | } |
| 238 | |
| 239 | case Event::LAUNCH: { |
| 240 | LOG(ERROR) << "LAUNCH event is not supported"; |
| 241 | // Shut down because this is unexpected; `LAUNCH` event |
| 242 | // should never go to the default executor. |
| 243 | shutdown(); |
| 244 | break; |
| 245 | } |
| 246 | |
| 247 | case Event::LAUNCH_GROUP: { |
| 248 | launchGroup(event.launch_group().task_group()); |
| 249 | break; |
| 250 | } |
| 251 | |
| 252 | case Event::KILL: { |
| 253 | Option<KillPolicy> killPolicy = event.kill().has_kill_policy() |
| 254 | ? Option<KillPolicy>(event.kill().kill_policy()) |
| 255 | : None(); |
| 256 | |
| 257 | killTask(event.kill().task_id(), killPolicy); |
| 258 | break; |
| 259 | } |
| 260 |
nothing calls this directly
no test coverage detected