Executor that is responsible to execute a docker container and redirect log output to configured stdout and stderr files. Similar to `CommandExecutor`, it launches a single task (a docker container) and exits after the task finishes or is killed. The executor assumes that it is launched from the `DockerContainerizer`.
| 90 | // and exits after the task finishes or is killed. The executor assumes |
| 91 | // that it is launched from the `DockerContainerizer`. |
| 92 | class DockerExecutorProcess : public ProtobufProcess<DockerExecutorProcess> |
| 93 | { |
| 94 | public: |
| 95 | DockerExecutorProcess( |
| 96 | const Owned<Docker>& docker, |
| 97 | const string& containerName, |
| 98 | const string& sandboxDirectory, |
| 99 | const string& mappedDirectory, |
| 100 | const Duration& shutdownGracePeriod, |
| 101 | const string& launcherDir, |
| 102 | const map<string, string>& taskEnvironment, |
| 103 | const Option<ContainerDNSInfo>& defaultContainerDNS, |
| 104 | bool cgroupsEnableCfs) |
| 105 | : ProcessBase(ID::generate("docker-executor")), |
| 106 | killed(false), |
| 107 | terminated(false), |
| 108 | killedByHealthCheck(false), |
| 109 | killedByTaskCompletionTimeout(false), |
| 110 | launcherDir(launcherDir), |
| 111 | docker(docker), |
| 112 | containerName(containerName), |
| 113 | sandboxDirectory(sandboxDirectory), |
| 114 | mappedDirectory(mappedDirectory), |
| 115 | shutdownGracePeriod(shutdownGracePeriod), |
| 116 | taskEnvironment(taskEnvironment), |
| 117 | defaultContainerDNS(defaultContainerDNS), |
| 118 | cgroupsEnableCfs(cgroupsEnableCfs), |
| 119 | stop(Nothing()), |
| 120 | inspect(Nothing()) {} |
| 121 | |
| 122 | ~DockerExecutorProcess() override {} |
| 123 | |
| 124 | void registered( |
| 125 | ExecutorDriver* _driver, |
| 126 | const ExecutorInfo& executorInfo, |
| 127 | const FrameworkInfo& _frameworkInfo, |
| 128 | const SlaveInfo& slaveInfo) |
| 129 | { |
| 130 | LOG(INFO) << "Registered docker executor on " << slaveInfo.hostname(); |
| 131 | driver = _driver; |
| 132 | frameworkInfo = _frameworkInfo; |
| 133 | } |
| 134 | |
| 135 | void reregistered( |
| 136 | ExecutorDriver* driver, |
| 137 | const SlaveInfo& slaveInfo) |
| 138 | { |
| 139 | LOG(INFO) << "Re-registered docker executor on " << slaveInfo.hostname(); |
| 140 | } |
| 141 | |
| 142 | void disconnected(ExecutorDriver* driver) |
| 143 | { |
| 144 | LOG(INFO) << "Disconnected from the agent"; |
| 145 | } |
| 146 | |
| 147 | void launchTask(ExecutorDriver* driver, const TaskInfo& task) |
| 148 | { |
| 149 | if (run.isSome()) { |
nothing calls this directly
no outgoing calls
no test coverage detected