Skip to content

Commit

Permalink
Replace artifactory by minio for public repo (#450)
Browse files Browse the repository at this point in the history
* Replace artifactory by minio for public repo

* Switch to Versioned interface for minio

* Use s3 instead of minio backend name
  • Loading branch information
hagenw authored Dec 5, 2024
1 parent 6c075b2 commit 446820a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
14 changes: 7 additions & 7 deletions audb/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def available(
Examples:
>>> df = audb.available(only_latest=True)
>>> df.loc[["air", "emodb"]]
backend host repository version
backend host repository version
name
air artifactory https://audeering.jfrog.io/artifactory data-public 1.4.2
emodb artifactory https://audeering.jfrog.io/artifactory data-public 1.4.1
air s3 s3.dualstack.eu-north-1.amazonaws.com audb-public 1.4.2
emodb s3 s3.dualstack.eu-north-1.amazonaws.com audb-public 1.4.1
""" # noqa: E501
databases = []
Expand All @@ -63,7 +63,7 @@ def add_database(name: str, version: str, repository: Repository):
try:
backend_interface = repository.create_backend_interface()
with backend_interface.backend as backend:
if repository.backend == "artifactory":
if repository.backend == "artifactory": # pragma: nocover
# avoid backend_interface.ls('/')
# which is very slow on Artifactory
# see https://github.com/audeering/audbackend/issues/132
Expand Down Expand Up @@ -569,7 +569,7 @@ def repository(
Examples:
>>> audb.repository("emodb", "1.4.1")
Repository('data-public', 'https://audeering.jfrog.io/artifactory', 'artifactory')
Repository('audb-public', 's3.dualstack.eu-north-1.amazonaws.com', 's3')
""" # noqa: E501
if not versions(name):
Expand Down Expand Up @@ -598,7 +598,7 @@ def versions(
try:
backend_interface = repository.create_backend_interface()
with backend_interface.backend as backend:
if repository.backend == "artifactory":
if repository.backend == "artifactory": # pragma: nocover
# Do not use `backend_interface.versions()` on Artifactory,
# as calling `backend_interface.ls()` is slow on Artifactory,
# see https://github.com/devopshq/artifactory/issues/423.
Expand All @@ -616,7 +616,7 @@ def versions(
header = p.joinpath(f"db-{version}.yaml")
if header.exists():
vs.extend([version])
except Exception: # pragma: nocover
except Exception:
# Might happen,
# if a database is not available on the backend,
# or we don't have read permissions.
Expand Down
6 changes: 3 additions & 3 deletions audb/core/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def public_repository():
r"""Provide access to the public Artifactory repository."""
audb.config.REPOSITORIES = [
audb.Repository(
name="data-public",
host="https://audeering.jfrog.io/artifactory",
backend="artifactory",
name="audb-public",
host="s3.dualstack.eu-north-1.amazonaws.com",
backend="s3",
),
]

Expand Down
6 changes: 3 additions & 3 deletions audb/core/etc/audb.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cache_root: ~/audb
shared_cache_root: /data/audb
repositories:
- name: data-public
backend: artifactory
host: https://audeering.jfrog.io/artifactory
- name: audb-public
backend: s3
host: s3.dualstack.eu-north-1.amazonaws.com
- name: data-local
backend: file-system
host: ~/audb-host
14 changes: 8 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
import audb


PUBLIC_HOST = "s3.dualstack.eu-north-1.amazonaws.com"
PUBLIC_BACKEND = "s3"


if platform.system() == "Darwin":
# Avoid multi-threading on MacOS runner,
# as it might fail from time to time
Expand Down Expand Up @@ -218,23 +222,21 @@ def private_and_public_repository():

@pytest.fixture(scope="module", autouse=False)
def non_existing_repository():
r"""Non-existing repository on Artifactory.
r"""Non-existing repository.
Configure the following repositories:
* non-existing: non-exsiting repo on public Artifactory
* data-public: repo on public Artifactory with anonymous access
* audb-public: repo on public Artifactory with anonymous access
Note, that the order of the repos is important.
audb will visit the repos in the given order
until it finds the requested database.
"""
host = "https://audeering.jfrog.io/artifactory"
backend = "artifactory"
current_repositories = audb.config.REPOSITORIES
audb.config.REPOSITORIES = [
audb.Repository("non-existing", host, backend),
audb.Repository("data-public", host, backend),
audb.Repository("non-existing", PUBLIC_HOST, PUBLIC_BACKEND),
audb.Repository("audb-public", PUBLIC_HOST, PUBLIC_BACKEND),
]

yield repository
Expand Down

0 comments on commit 446820a

Please sign in to comment.