Skip to content

Commit

Permalink
hotfix: fix docker link parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnacioHeredia committed Oct 21, 2024
1 parent e9ac53d commit 7772654
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions ai4papi/routers/v1/catalog/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def get_metadata(
# TODO: when the migration is finished, we have to generate the url from the module name
# (ie. ignore the value coming from the metadata)
metadata['links']['docker_image'] = f"https://hub.docker.com/r/{metadata['links']['docker_image']}"
metadata['links']['docker_image'] = metadata['links']['docker_image'].strip('/ ')

return metadata

Expand Down
2 changes: 1 addition & 1 deletion ai4papi/routers/v1/catalog/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_config(

# Parse docker registry
registry = metadata['links']['docker_image']
repo, image = registry.split('/')[:2]
repo, image = registry.split('/')[-2:]
if repo not in ['deephdc', 'ai4oshub']:
repo = 'ai4oshub'

Expand Down
2 changes: 1 addition & 1 deletion ai4papi/routers/v1/catalog/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_config(

# Parse docker registry
registry = metadata['links']['docker_image']
repo, image = registry.split('/')[:2]
repo, image = registry.split('/')[-2:]
if repo not in ['deephdc', 'ai4oshub']:
repo = 'ai4oshub'

Expand Down
3 changes: 2 additions & 1 deletion ai4papi/routers/v1/try_me/nomad.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def create_deployment(

# Retrieve docker_image from module_name
meta = Modules.get_metadata(module_name)
docker_image = meta['links']['docker_image']
registry = meta['links']['docker_image']
docker_image = '/'.join(registry.split('/')[-2:])

# Load module configuration
nomad_conf = deepcopy(papiconf.TRY_ME['nomad'])
Expand Down

0 comments on commit 7772654

Please sign in to comment.