mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-09 21:40:55 +08:00
Do not cache index.html (#1603)
* Fix typo * Run black for code formatting * Do not cache index.html
This commit is contained in:
+4
-2
@@ -47,7 +47,7 @@ def _cache_control(always, **cache_kwargs):
|
|||||||
|
|
||||||
|
|
||||||
def cache_control(**cache_kwargs):
|
def cache_control(**cache_kwargs):
|
||||||
""" configu driven """
|
""" config driven """
|
||||||
return _cache_control(False, **cache_kwargs)
|
return _cache_control(False, **cache_kwargs)
|
||||||
|
|
||||||
|
|
||||||
@@ -56,8 +56,10 @@ def cache_control_always(**cache_kwargs):
|
|||||||
return _cache_control(True, **cache_kwargs)
|
return _cache_control(True, **cache_kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
# tell the client not to cache the index.html page so that changes to the app work on redeployment
|
||||||
|
# note that the bulk of the data needed by the client (datasets) will still be cached
|
||||||
@webbp.route("/", methods=["GET"])
|
@webbp.route("/", methods=["GET"])
|
||||||
@cache_control(public=True, max_age=ONE_WEEK)
|
@cache_control_always(public=True, max_age=0, no_store=True, no_cache=True, must_revalidate=True)
|
||||||
def dataset_index(url_dataroot=None, dataset=None):
|
def dataset_index(url_dataroot=None, dataset=None):
|
||||||
config = current_app.app_config
|
config = current_app.app_config
|
||||||
if dataset is None:
|
if dataset is None:
|
||||||
|
|||||||
@@ -493,8 +493,7 @@ def evaluate_for_sparse_column_shift_encoding(xdata, sparse_threshold):
|
|||||||
nnz += shape[0] * (lim - col) - np.sum(m.count)
|
nnz += shape[0] * (lim - col) - np.sum(m.count)
|
||||||
if nnz > maxnnz:
|
if nnz > maxnnz:
|
||||||
return (None, nnz, shape[0] * lim)
|
return (None, nnz, shape[0] * lim)
|
||||||
log(2, "\t...cols", lim, "of", shape[1], "nnz",
|
log(2, "\t...cols", lim, "of", shape[1], "nnz", nnz, "nnz percent %5.2f%%" % (100 * nnz / (lim * shape[0])))
|
||||||
nnz, "nnz percent %5.2f%%" % (100 * nnz / (lim * shape[0])))
|
|
||||||
|
|
||||||
is_sparse = (100.0 * nnz / (shape[0] * shape[1])) < sparse_threshold
|
is_sparse = (100.0 * nnz / (shape[0] * shape[1])) < sparse_threshold
|
||||||
return (col_shift if is_sparse else None, nnz, shape[0] * shape[1])
|
return (col_shift if is_sparse else None, nnz, shape[0] * shape[1])
|
||||||
|
|||||||
@@ -38,8 +38,7 @@ def main():
|
|||||||
print("input is not a directory", args.input)
|
print("input is not a directory", args.input)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
shutil.copytree(args.input, args.output,
|
shutil.copytree(args.input, args.output, ignore=shutil.ignore_patterns("X", "X_col_shift"))
|
||||||
ignore=shutil.ignore_patterns("X", "X_col_shift"))
|
|
||||||
|
|
||||||
ctx = tiledb.Ctx(
|
ctx = tiledb.Ctx(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,8 +50,7 @@ class AppConfigTest(unittest.TestCase):
|
|||||||
# test that multi dataroots work end to end
|
# test that multi dataroots work end to end
|
||||||
c.update(
|
c.update(
|
||||||
multi_dataset__dataroot=dict(
|
multi_dataset__dataroot=dict(
|
||||||
set1=f"{PROJECT_ROOT}/example-dataset",
|
set1=f"{PROJECT_ROOT}/example-dataset", set2=f"{PROJECT_ROOT}/server/test/test_datasets"
|
||||||
set2=f"{PROJECT_ROOT}/server/test/test_datasets"
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
c.complete_config()
|
c.complete_config()
|
||||||
|
|||||||
Reference in New Issue
Block a user