Commit 597dfd1f authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added configurability on files and directory names.

parent 56008890
...@@ -22,7 +22,7 @@ import logging ...@@ -22,7 +22,7 @@ import logging
from collections import namedtuple from collections import namedtuple
FilesConfig = namedtuple( FilesConfig = namedtuple(
'FilesConfig', ['uploads_bucket', 'repository_bucket', 'archive_bucket', 'compress_archive']) 'FilesConfig', ['uploads_bucket', 'raw_bucket', 'archive_bucket', 'compress_archive'])
""" API independent configuration for the object storage. """ """ API independent configuration for the object storage. """
CeleryConfig = namedtuple('Celery', ['broker_url']) CeleryConfig = namedtuple('Celery', ['broker_url'])
...@@ -48,7 +48,7 @@ NomadServicesConfig = namedtuple('NomadServicesConfig', ['api_host', 'api_port', ...@@ -48,7 +48,7 @@ NomadServicesConfig = namedtuple('NomadServicesConfig', ['api_host', 'api_port',
files = FilesConfig( files = FilesConfig(
uploads_bucket='uploads', uploads_bucket='uploads',
repository_bucket='repository', raw_bucket=os.environ.get('NOMAD_FILES_RAW_BUCKET', 'raw'),
archive_bucket='archive', archive_bucket='archive',
compress_archive=True compress_archive=True
) )
...@@ -76,8 +76,8 @@ celery = CeleryConfig( ...@@ -76,8 +76,8 @@ celery = CeleryConfig(
) )
fs = FSConfig( fs = FSConfig(
tmp='.volumes/fs/tmp', tmp=os.environ.get('NOMAD_FILES_TMP_DIR', '.volumes/fs/tmp'),
objects='.volumes/fs/objects' objects=os.environ.get('NOMAD_FILES_OBJECTS_DIR', '.volumes/fs/objects')
) )
elastic = ElasticConfig( elastic = ElasticConfig(
host=os.environ.get('NOMAD_ELASTIC_HOST', 'localhost'), host=os.environ.get('NOMAD_ELASTIC_HOST', 'localhost'),
......
...@@ -346,7 +346,7 @@ class UploadFile(ObjectFile): ...@@ -346,7 +346,7 @@ class UploadFile(ObjectFile):
object_id = self.upload_hash() object_id = self.upload_hash()
return ZippedDataContainer.create( return ZippedDataContainer.create(
self._extract_dir, Objects._os_path(config.files.repository_bucket, object_id)) self._extract_dir, Objects._os_path(config.files.raw_bucket, object_id))
@Decorators.handle_errors @Decorators.handle_errors
def remove_extract(self) -> None: def remove_extract(self) -> None:
...@@ -404,7 +404,7 @@ class RepositoryFile(ObjectFile): ...@@ -404,7 +404,7 @@ class RepositoryFile(ObjectFile):
""" """
def __init__(self, upload_hash: str) -> None: def __init__(self, upload_hash: str) -> None:
super().__init__( super().__init__(
bucket=config.files.repository_bucket, bucket=config.files.raw_bucket,
object_id=upload_hash, object_id=upload_hash,
ext='zip') ext='zip')
......
...@@ -141,7 +141,7 @@ class TestZippedDataContainer(TestBaggedDataContainer): ...@@ -141,7 +141,7 @@ class TestZippedDataContainer(TestBaggedDataContainer):
def archive_config(monkeypatch, request): def archive_config(monkeypatch, request):
new_config = config.FilesConfig( new_config = config.FilesConfig(
config.files.uploads_bucket, config.files.uploads_bucket,
config.files.repository_bucket, config.files.raw_bucket,
config.files.archive_bucket, config.files.archive_bucket,
request.param) request.param)
monkeypatch.setattr(config, 'files', new_config) monkeypatch.setattr(config, 'files', new_config)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment