| 231 | |
| 232 | |
| 233 | Future<DockerTaskExecutorPrepareInfo> |
| 234 | HookManager::slavePreLaunchDockerTaskExecutorDecorator( |
| 235 | const Option<TaskInfo>& taskInfo, |
| 236 | const ExecutorInfo& executorInfo, |
| 237 | const string& containerName, |
| 238 | const string& containerWorkDirectory, |
| 239 | const string& mappedSandboxDirectory, |
| 240 | const Option<map<string, string>>& env) |
| 241 | { |
| 242 | // We execute these hooks according to their ordering so any conflicting |
| 243 | // `DockerTaskExecutorPrepareInfo` can be deterministically resolved |
| 244 | // (the last hook takes priority). |
| 245 | vector<Future<Option<DockerTaskExecutorPrepareInfo>>> futures; |
| 246 | synchronized (mutex) { |
| 247 | futures.reserve(availableHooks->size()); |
| 248 | |
| 249 | foreachvalue (Hook* hook, *availableHooks) { |
| 250 | // Chain together each hook. |
| 251 | futures.push_back( |
| 252 | hook->slavePreLaunchDockerTaskExecutorDecorator( |
| 253 | taskInfo, |
| 254 | executorInfo, |
| 255 | containerName, |
| 256 | containerWorkDirectory, |
| 257 | mappedSandboxDirectory, |
| 258 | env)); |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | return collect(futures) |
| 263 | .then([](const vector<Option<DockerTaskExecutorPrepareInfo>>& results) |
| 264 | -> Future<DockerTaskExecutorPrepareInfo> { |
| 265 | DockerTaskExecutorPrepareInfo taskExecutorDecoratorInfo; |
| 266 | |
| 267 | foreach (const Option<DockerTaskExecutorPrepareInfo>& result, results) { |
| 268 | if (result.isSome()) { |
| 269 | taskExecutorDecoratorInfo.MergeFrom(result.get()); |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | return taskExecutorDecoratorInfo; |
| 274 | }); |
| 275 | } |
| 276 | |
| 277 | |
| 278 | void HookManager::slavePostFetchHook( |
no test coverage detected