Skip to content

Commit

Permalink
Rebasing properly
Browse files Browse the repository at this point in the history
Signed-off-by: Aloys Baillet <[email protected]>
  • Loading branch information
aloysbaillet committed Feb 13, 2021
1 parent 063938f commit 868f2e6
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 59 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta:__legacy__"
4 changes: 2 additions & 2 deletions python/aswfdocker/cli/aswfdocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def images():
"""Lists all known CI images in this format: IMAGEGROUP/IMAGE:VERSION
"""
for image_type in (constants.ImageType.CI_IMAGE, constants.ImageType.RT_IMAGE):
for group, images in constants.GROUPS[image_type].items():
for group, images in index.Index().groups[image_type].items():
for image in images:
image_name = utils.get_image_name(image_type, image)
for version in index.Index().iter_versions(image_type, image):
Expand Down Expand Up @@ -403,7 +403,7 @@ def dockergen(context, image_name, check):
"""
if image_name == "all":
images = []
for gimages in index.Index().groups[constants.ImageType.IMAGE].values():
for gimages in index.Index().groups[constants.ImageType.CI_IMAGE].values():
images.extend(gimages)
else:
images = [image_name]
Expand Down
2 changes: 1 addition & 1 deletion python/aswfdocker/data/ci-image-readme.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ for further information, and participate in the discussion on the

[Docker Image Source](https://github.com/AcademySoftwareFoundation/aswf-docker/blob/master/ci-{{ name }}/Dockerfile)

{% for version in index.iter_versions(constants.ImageType.IMAGE, name) -%}
{% for version in index.iter_versions(constants.ImageType.CI_IMAGE, name) -%}
## [aswf/ci-{{name}}:{{version}}](https://hub.docker.com/r/aswf/ci-{{name}}/tags?page=1&name={{version}})

Contains:
Expand Down
23 changes: 22 additions & 1 deletion python/aswfdocker/data/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,20 @@ ci-images:
- "2020-clang7.9"
- "2021-clang10.5"

rt-images:
base:
- "2019.0"
- "2020.0"
- "2021.0"
vfxall:
- "2019.0"
- "2020.0"
- "2021.0"
vfxall-jupyter:
- "2019.0"
- "2020.0"
- "2021.0"

groups:
package:
common:
Expand Down Expand Up @@ -476,7 +490,7 @@ groups:
- partio
- ptex
- usd
image:
ci-image:
common:
- common
base:
Expand All @@ -493,6 +507,13 @@ groups:
- osl
- openvdb
- vfxall
rt-image:
base:
- base
vfx:
- vfxall
- vfxall-jupyter


package_data:
python:
Expand Down
3 changes: 2 additions & 1 deletion python/aswfdocker/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def __init__(self):
with path.open() as f:
self._versions = yaml.load(f, Loader=yaml.FullLoader)
self.groups = {
constants.ImageType.IMAGE: self._versions["groups"]["image"],
constants.ImageType.CI_IMAGE: self._versions["groups"]["ci-image"],
constants.ImageType.RT_IMAGE: self._versions["groups"]["rt-image"],
constants.ImageType.PACKAGE: self._versions["groups"]["package"],
}
self._version_infos = {}
Expand Down
4 changes: 2 additions & 2 deletions python/aswfdocker/tests/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ def test_image_base_2019clang_dict(self):
groupinfo.GroupInfo(
names=["vfx3"],
versions=["2019-clang9"],
type_=constants.ImageType.IMAGE,
type_=constants.ImageType.CI_IMAGE,
targets=["openvdb"],
),
)
openvdb_version = list(
index.Index().iter_versions(constants.ImageType.IMAGE, "openvdb")
index.Index().iter_versions(constants.ImageType.CI_IMAGE, "openvdb")
)[4]
self.assertEqual(
b.make_bake_dict(),
Expand Down
2 changes: 1 addition & 1 deletion python/aswfdocker/tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_get_versions(self):
self.assertGreater(len(ciimages), 1)
self.assertEqual(ciimages[0], "common")
rtimages = list(self.index.iter_images(constants.ImageType.RT_IMAGE))
self.assertGreater(len(rtimages), 1)
self.assertGreater(len(rtimages), 0)
self.assertEqual(rtimages[0], "base")
versions = list(
self.index.iter_versions(constants.ImageType.CI_IMAGE, ciimages[0])
Expand Down
51 changes: 0 additions & 51 deletions python/aswfdocker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,6 @@ def get_image_spec(name: str):
return org, image_type, image, version


<<<<<<< HEAD
def get_group_from_image(image_type: constants.ImageType, image: str):
for group, images in constants.GROUPS[image_type].items():
for img in images:
if img == image:
return group
raise RuntimeError(f"Cannot find group for image {image}")


<<<<<<< HEAD
def get_image_pull_count(docker_org, image):
url = f"https://hub.docker.com/v2/repositories/{docker_org}/{image}"
try:
Expand Down Expand Up @@ -156,52 +146,12 @@ def get_image_sizes(docker_org, image):
return sizes


def iter_all_images():
for org in (constants.TESTING_DOCKER_ORG, constants.PUBLISH_DOCKER_ORG):
for image_type in (
constants.ImageType.PACKAGE,
constants.ImageType.CI_IMAGE,
constants.ImageType.RT_IMAGE,
):
for _, images in constants.GROUPS[image_type].items():
for image in images:
yield org, image_type, image


def get_dockerhub_token(username, password):
body = {"username": username, "password": password}
response = requests.post("https://hub.docker.com/v2/users/login", json=body)
return response.json()["token"]


def get_image_pull_count(docker_org, image):
url = f"https://hub.docker.com/v2/repositories/{docker_org}/{image}"
try:
d = json.loads(urllib.request.urlopen(url).read())
return d["pull_count"]
except urllib.error.HTTPError:
logger.debug("Failed to load data from URL %r", url)
return 0


def get_image_sizes(docker_org, image):
sizes = {}
url = f"https://hub.docker.com/v2/repositories/{docker_org}/{image}/tags/"
try:
d = json.loads(urllib.request.urlopen(url).read())
except urllib.error.HTTPError:
logger.debug("Failed to load data from URL %r", url)
return sizes
digests = set()
for tag in d["results"]:
digest = tag["images"][0]["digest"]
if digest in digests:
continue
digests.add(digest)
sizes[tag["name"]] = tag["full_size"]
return sizes


def iter_all_images():
for org in (constants.TESTING_DOCKER_ORG, constants.PUBLISH_DOCKER_ORG):
for image_type in (
Expand All @@ -212,4 +162,3 @@ def iter_all_images():
for _, images in constants.GROUPS[image_type].items():
for image in images:
yield org, image_type, image
>>>>>>> Added dockerstats command

0 comments on commit 868f2e6

Please sign in to comment.