Skip to content

Commit

Permalink
docs: Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Aug 5, 2024
1 parent 6a6f33c commit dfbd5d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/ai/backend/common/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ async def login(
return {"auth": basic_auth, "headers": {}}
elif ping_status == 404:
raise RuntimeError(f"Unsupported docker registry: {registry_url}! (API v2 not implemented)")
# Should check also 400 status since the AWS ECR Public server returns a 400 response
# when given invalid credential authorization.
elif ping_status in [400, 401]:
params = {
"scope": scope,
Expand Down
4 changes: 2 additions & 2 deletions src/ai/backend/manager/container_registry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def get_container_registry_cls(registry_info: Mapping[str, Any]) -> Type[BaseCon

cr_cls = GitLabRegistry
elif registry_type == "ecr" or registry_type == "ecr-public":
from .aws_ecr import AWSElasticContainerRegistry_v2
from .aws_ecr import AWSElasticContainerRegistry

cr_cls = AWSElasticContainerRegistry_v2
cr_cls = AWSElasticContainerRegistry
elif registry_type == "local":
from .local import LocalRegistry

Expand Down
4 changes: 3 additions & 1 deletion src/ai/backend/manager/container_registry/aws_ecr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
log = BraceStyleAdapter(logging.getLogger(__spec__.name)) # type: ignore[name-defined]


class AWSElasticContainerRegistry_v2(BaseContainerRegistry):
class AWSElasticContainerRegistry(BaseContainerRegistry):
async def fetch_repositories(
self,
sess: aiohttp.ClientSession,
Expand Down Expand Up @@ -41,6 +41,8 @@ async def fetch_repositories(
response = client.describe_repositories(maxResults=30)

for repo in response["repositories"]:
# repositoryUri format:
# public.ecr.aws/<registry_alias>/<repository>
registry_alias = (repo["repositoryUri"].split("/"))[1]
yield f"{registry_alias}/{repo["repositoryName"]}"

Expand Down

0 comments on commit dfbd5d0

Please sign in to comment.