Skip to content

Commit

Permalink
Change the cache settings (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon authored Sep 27, 2024
1 parent d3b6e80 commit a4dcc47
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .env.dev
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Disable debug mode per default
DEBUG=0
# Disable cache to avoid memory issues
USE_CACHE=0
AUTO_ACMG_USE_CACHE=0
# Use the REEV API. Change it if you have other instance of REEV.
API_REEV_URL=https://reev.cubi.bihealth.org/internal/proxy
AUTO_ACMG_API_ANNONARS_URL=https://reev.cubi.bihealth.org/internal/proxy/annonars
Expand Down
11 changes: 6 additions & 5 deletions docs/dev_quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ Then you can initialize the SeqRepo instance:
.. note::

The ``-i auto-acmg`` flag is used to set the SeqRepo instance name to ``auto-acmg``.
If you want to use a different default seqrepo directory, you can set the ``SEQREPO_DIR``
environment variable or provide the ``-r`` flag to the ``seqrepo`` command.
If you want to use a different default seqrepo directory, you can set the
``AUTO_ACMG_SEQREPO_DATA_DIR`` environment variable or provide the ``-r`` flag to the
``seqrepo`` command.


2. Download the reference genomes:
Expand Down Expand Up @@ -156,12 +157,12 @@ can be found in the `.env.dev` file. Copy the contents with the following comman
cp .env.dev .env
**Important**: You need to set the `SEQREPO_DIR` variable in the `.env` file to the path of the
SeqRepo instance you created in the previous step. It should look similar to this:
**Important**: You need to set the `AUTO_ACMG_SEQREPO_DATA_DIR` variable in the `.env` file to the
path of the SeqRepo instance you created in the previous step. It should look similar to this:

.. code-block:: bash
SEQREPO_DIR=/usr/local/share/seqrepo/auto-acmg
AUTO_ACMG_SEQREPO_DATA_DIR=/usr/local/share/seqrepo/auto-acmg
---------------
Running the CLI
Expand Down
6 changes: 3 additions & 3 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ Adjust the values according to your environment. Here are brief descriptions of
that not all variables are required for the application to run. More info below.:

- ``DEBUG``: Enable or disable debug mode.
- ``USE_CACHE``: Enable or disable caching of API responses.
- ``CACHE_DIR``: Path to the cache directory.
- ``AUTO_ACMG_USE_CACHE``: Enable or disable caching of API responses.
- ``AUTO_ACMG_CACHE_DIR``: Path to the cache directory.
- ``API_V1_STR``: Base path for API endpoints.
- ``API_REEV_URL``: URL of the REEV API.
- ``AUTO_ACMG_API_ANNONARS_URL``: URL of the Annonars API.
Expand All @@ -153,7 +153,7 @@ that not all variables are required for the application to run. More info below.
You will most likely need to set the following variables:

- ``DEBUG``: Set to ``1`` to enable debug mode.
- ``USE_CACHE``: Set to ``1`` to enable caching. This is recommended only for development.
- ``AUTO_ACMG_USE_CACHE``: Set to ``1`` to enable caching. This is recommended only for development.
- ``AUTO_ACMG_SEQREPO_DATA_DIR``: Set to the path of the custom project SeqRepo data directory.

To pass this configuration to the Docker container, ensure the ``.env`` file is located where
Expand Down
4 changes: 2 additions & 2 deletions src/core/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Cache:

def __init__(self):
"""Set up the cache directory and settings."""
self.use_cache = settings.USE_CACHE
self.cache_dir = settings.CACHE_DIR
self.use_cache = settings.AUTO_ACMG_USE_CACHE
self.cache_dir = settings.AUTO_ACMG_CACHE_DIR
if not os.path.exists(self.cache_dir):
os.makedirs(self.cache_dir)

Expand Down
4 changes: 2 additions & 2 deletions src/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class Settings(BaseSettings):
#: Whether to enable debug mode
DEBUG: bool = False
#: Whether to use cache
USE_CACHE: bool = True
AUTO_ACMG_USE_CACHE: bool = False
#: Path to the cache directory
CACHE_DIR: str = os.path.join(
AUTO_ACMG_CACHE_DIR: str = os.path.join(
os.path.abspath(os.path.join(__file__, "..", "..", "..")), "cache"
)

Expand Down

0 comments on commit a4dcc47

Please sign in to comment.