Skip to content

Commit

Permalink
feat(redis-cache): add module (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlemesh committed Aug 20, 2024
1 parent 273b72d commit 9a86a1b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The list of contributors in alphabetical order:
- [Dinos Kousidis](https://orcid.org/0000-0002-4914-4289)
- [Giuseppe Steduto](https://orcid.org/0009-0002-1258-8553)
- [Jan Okraska](https://orcid.org/0000-0002-1416-3244)
- [Jelizaveta Lemeševa](https://orcid.org/0009-0003-6606-9270)
- [Kenyi Hurtado-Anampa](https://orcid.org/0000-0002-9779-3566)
- [Leticia Wanderley](https://orcid.org/0000-0003-4649-6630)
- [Marco Donadoni](https://orcid.org/0000-0003-2922-5505)
Expand Down
3 changes: 3 additions & 0 deletions reana_commons/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,6 @@ def default_workspace():
"REANA_KRB5_CONFIGMAP_NAME", f"{REANA_COMPONENT_PREFIX}-krb5-conf"
)
"""Kerberos configMap name."""

REDIS_CACHE_PORT = 6379
"""Redis cache port."""

Check warning on line 504 in reana_commons/config.py

View check run for this annotation

Codecov / codecov/patch

reana_commons/config.py#L503-L504

Added lines #L503 - L504 were not covered by tests
25 changes: 25 additions & 0 deletions reana_commons/redis_cache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2024 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

"""REANA-commons Redis cache."""

Check warning on line 9 in reana_commons/redis_cache.py

View check run for this annotation

Codecov / codecov/patch

reana_commons/redis_cache.py#L9

Added line #L9 was not covered by tests

from redis import StrictRedis
from redis_cache import RedisCache

Check warning on line 12 in reana_commons/redis_cache.py

View check run for this annotation

Codecov / codecov/patch

reana_commons/redis_cache.py#L11-L12

Added lines #L11 - L12 were not covered by tests

from reana_commons.config import (

Check warning on line 14 in reana_commons/redis_cache.py

View check run for this annotation

Codecov / codecov/patch

reana_commons/redis_cache.py#L14

Added line #L14 was not covered by tests
REANA_INFRASTRUCTURE_COMPONENTS_HOSTNAMES,
REDIS_CACHE_PORT,
)

redis_cache = RedisCache(

Check warning on line 19 in reana_commons/redis_cache.py

View check run for this annotation

Codecov / codecov/patch

reana_commons/redis_cache.py#L19

Added line #L19 was not covered by tests
redis_client=StrictRedis(
host=REANA_INFRASTRUCTURE_COMPONENTS_HOSTNAMES["cache"],
port=REDIS_CACHE_PORT,
decode_responses=True,
)
)
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
"snakemake[reports] @ git+https://github.com/mdonadoni/snakemake.git@cea31624976989ad0645eb2e1751260d32259506", # branch `7.32.4-python3.12`
"pulp>=2.7.0,<2.8.0",
],
"redis-cache": [
"python-redis-cache>=4.0.0,<4.1.0",
],
}

# backwards compatibility with extras before PEP 685
Expand Down

0 comments on commit 9a86a1b

Please sign in to comment.