Improvements to the matrix cache (#1340)

* Improvements to the matrix cache

- Add a timelimit for the matrix in the cache.
Once the timelimit is reached, the matrix can be removed.

- If a DatasetAccessError occurs, then remove the dataset
from the matrix cache.

Fixes #1322
This commit is contained in:
bmccandless
2020-04-02 13:44:11 -07:00
committed by GitHub
parent fa0164fdf6
commit 308ee64f30
9 changed files with 260 additions and 61 deletions
+4 -7
View File
@@ -11,7 +11,6 @@ from flask_cors import CORS
from server.common.utils import sort_options
from server.common.errors import DatasetAccessError, ConfigurationError
from server.data_common.matrix_loader import MatrixDataCacheManager
from server.common.app_config import AppConfig
from server.common.default_config import default_config
from server.app.app import Server
@@ -276,8 +275,8 @@ class CliLaunchServer(Server):
the CLI runs a local web server, and needs to enable a few more features.
"""
def __init__(self, matrix_data_cache_manager, annotations, app_config):
super().__init__(matrix_data_cache_manager, annotations, app_config)
def __init__(self, app_config):
super().__init__(app_config)
def _before_adding_routes(self, app_config):
self.app.config["COMPRESS_MIMETYPES"] = [
@@ -388,12 +387,11 @@ def launch(
# process the configuration
# any errors will be thrown as an exception.
# any info messages will be passed to the messagefn function.
matrix_data_cache_manager = MatrixDataCacheManager()
def messagefn(message):
click.echo("[cellxgene] " + message)
app_config.complete_config(matrix_data_cache_manager, messagefn)
app_config.complete_config(messagefn)
# Use a default secret if one is not provided
if not app_config.server__flask_secret_key:
@@ -403,10 +401,9 @@ def launch(
raise click.ClickException(e)
handle_scripts(scripts)
user_annotations = app_config.user_annotations
# create the server
server = CliLaunchServer(matrix_data_cache_manager, user_annotations, app_config)
server = CliLaunchServer(app_config)
if not app_config.server__verbose:
log = logging.getLogger("werkzeug")