|
2 | 2 | Handlers for working with version control services (i.e. GitHub) for builds.
|
3 | 3 | """
|
4 | 4 |
|
| 5 | +import asyncio |
5 | 6 | import hashlib
|
6 | 7 | from http.client import responses
|
7 | 8 | import json
|
|
10 | 11 | import escapism
|
11 | 12 |
|
12 | 13 | import docker
|
13 |
| -from tornado.concurrent import chain_future, Future |
14 | 14 | from tornado import gen
|
15 | 15 | from tornado.httpclient import HTTPClientError
|
16 | 16 | from tornado.web import Finish, authenticated
|
@@ -485,19 +485,16 @@ async def launch(self, kube, provider):
|
485 | 485 | self.settings["build_namespace"],
|
486 | 486 | label_selector='app=jupyterhub,component=singleuser-server',
|
487 | 487 | _request_timeout=KUBE_REQUEST_TIMEOUT,
|
| 488 | + _preload_content=False, |
488 | 489 | )
|
489 |
| - # concurrent.futures.Future isn't awaitable |
490 |
| - # wrap in tornado Future |
491 |
| - # tornado 5 will have `.run_in_executor` |
492 |
| - tf = Future() |
493 |
| - chain_future(f, tf) |
494 |
| - pods = await tf |
495 |
| - for pod in pods.items: |
| 490 | + resp = await asyncio.wrap_future(f) |
| 491 | + pods = json.loads(resp.read()) |
| 492 | + for pod in pods["items"]: |
496 | 493 | total_pods += 1
|
497 |
| - for container in pod.spec.containers: |
| 494 | + for container in pod["spec"]["containers"]: |
498 | 495 | # is the container running the same image as us?
|
499 | 496 | # if so, count one for the current repo.
|
500 |
| - image = container.image.rsplit(':', 1)[0] |
| 497 | + image = container["image"].rsplit(":", 1)[0] |
501 | 498 | if image == image_no_tag:
|
502 | 499 | matching_pods += 1
|
503 | 500 | break
|
|
0 commit comments