After starting the task, we need to make sure its container has actually been added to the agent before proceeding.
(self, timeout=TIMEOUT)
| 377 | |
| 378 | # pylint: disable=arguments-differ |
| 379 | def launch(self, timeout=TIMEOUT): |
| 380 | """ |
| 381 | After starting the task, we need to make sure its container |
| 382 | has actually been added to the agent before proceeding. |
| 383 | """ |
| 384 | super(Task, self).launch() |
| 385 | Task.count += 1 |
| 386 | |
| 387 | try: |
| 388 | # pylint: disable=missing-docstring |
| 389 | def container_exists(data): |
| 390 | return any(container["executor_id"] == self.flags["name"] |
| 391 | for container in data) |
| 392 | |
| 393 | self.__wait_for_containers(container_exists, timeout) |
| 394 | except Exception as exception: |
| 395 | stdout = "" |
| 396 | if self.proc.poll(): |
| 397 | stdout = "\n{output}".format(output=self.proc.stdout.read()) |
| 398 | self.proc = None |
| 399 | |
| 400 | raise CLIException("Waiting for container '{name}'" |
| 401 | " failed: {error}{stdout}" |
| 402 | .format(name=self.flags["name"], |
| 403 | error=exception, |
| 404 | stdout=stdout)) |
| 405 | |
| 406 | # pylint: disable=arguments-differ |
| 407 | def kill(self, timeout=TIMEOUT): |