Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cache timeout for GCS configurable #490

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/source/deploying/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@ Quetz can store packages in Google Cloud Storage. To configure, use the followin
token = ".."
bucket_prefix="..."
bucket_suffix="..."
cache_timeout="..."

:project: The Google Cloud Project ID to work under
:token: A token to pass the `gcsfs`. See the `gcsfs documention <https://gcsfs.readthedocs.io/en/latest/index.html#credentials>`_ for valid values.
:bucket_prefix:
:bucket_suffix: channel buckets on GCS are created with the following semantics: ``{bucket_prefix}{channel_name}{bucket_suffix}``
:cache_timeout: Timeout in s after which local GCS cache entries are invalidated. Set to a value <=0 to disable caching completely. Default is that entries are never invalidated.

``local_store`` section
^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
- alembic
- zchunk
- s3fs
- gcsfs >=2021.10.1
- gcsfs >=2022.02
- sphinx
- sphinx-book-theme
- tenacity
Expand Down
2 changes: 2 additions & 0 deletions quetz/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class Config:
ConfigEntry("token", str, default=""),
ConfigEntry("bucket_prefix", str, default=""),
ConfigEntry("bucket_suffix", str, default=""),
ConfigEntry("cache_timeout", int, default=None),
],
required=False,
),
Expand Down Expand Up @@ -403,6 +404,7 @@ def get_package_store(self) -> pkgstores.PackageStore:
'token': self.gcs_token,
'bucket_prefix': self.gcs_bucket_prefix,
'bucket_suffix': self.gcs_bucket_suffix,
'cache_timeout': self.gcs_cache_timeout,
}
)
else:
Expand Down
2 changes: 2 additions & 0 deletions quetz/pkgstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,12 @@ def __init__(self, config):

self.project = config.get("project")
self.token = config.get("token")
self.cache_timeout = config.get("cache_timeout")

self.fs = gcsfs.GCSFileSystem(
project=self.project,
token=self.token if self.token else None,
cache_timeout=self.cache_timeout,
)

self.bucket_prefix = config['bucket_prefix']
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ console_scripts =
azure =
adlfs
gcs =
gcsfs >=2021.10.1
gcsfs >=2022.02
pam =
pamela
postgre =
Expand Down