mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-03 14:08:12 +08:00
config refactor (#1854)
* split out config * add tests for base and app config, refactor client config out of app config * refactor default config retrieval * create config test class and helper functions * move default_config into server to fix import issue
This commit is contained in:
+8
-18
@@ -29,34 +29,26 @@ class TestDatabase:
|
||||
|
||||
def _create_test_user(self):
|
||||
user = CellxGeneUser(id="test_user_id")
|
||||
user2 = CellxGeneUser(id='1234')
|
||||
user2 = CellxGeneUser(id="1234")
|
||||
self.db.session.add(user)
|
||||
self.db.session.add(user2)
|
||||
self.db.session.commit()
|
||||
|
||||
def _create_test_dataset(self):
|
||||
dataset = CellxGeneDataset(
|
||||
name="test_dataset",
|
||||
)
|
||||
dataset = CellxGeneDataset(name="test_dataset",)
|
||||
self.db.session.add(dataset)
|
||||
self.db.session.commit()
|
||||
|
||||
def _create_test_annotation(self):
|
||||
dataset = self.db.query([CellxGeneDataset],
|
||||
[CellxGeneDataset.name == "test_dataset"],
|
||||
)[0]
|
||||
annotation = Annotation(
|
||||
tiledb_uri="tiledb_uri",
|
||||
user_id="test_user_id",
|
||||
dataset_id=str(dataset.id)
|
||||
)
|
||||
dataset = self.db.query([CellxGeneDataset], [CellxGeneDataset.name == "test_dataset"],)[0]
|
||||
annotation = Annotation(tiledb_uri="tiledb_uri", user_id="test_user_id", dataset_id=str(dataset.id))
|
||||
self.db.session.add(annotation)
|
||||
self.db.session.commit()
|
||||
|
||||
@staticmethod
|
||||
def get_random_string():
|
||||
letters = string.ascii_lowercase
|
||||
return ''.join(random.choice(letters) for i in range(12))
|
||||
return "".join(random.choice(letters) for i in range(12))
|
||||
|
||||
def _create_test_users(self, user_count: int = 10):
|
||||
users = []
|
||||
@@ -80,10 +72,8 @@ class TestDatabase:
|
||||
for i in range(annotation_count):
|
||||
dataset = self.order_by_random(CellxGeneDataset)
|
||||
user = self.order_by_random(CellxGeneUser)
|
||||
annotations.append(Annotation(
|
||||
tiledb_uri=self.get_random_string(),
|
||||
user_id=user.id,
|
||||
dataset_id=str(dataset.id)
|
||||
))
|
||||
annotations.append(
|
||||
Annotation(tiledb_uri=self.get_random_string(), user_id=user.id, dataset_id=str(dataset.id))
|
||||
)
|
||||
self.db.session.add_all(annotations)
|
||||
self.db.session.commit()
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
f"""
|
||||
dataset:
|
||||
app:
|
||||
scripts: {scripts} #list of strs (filenames) or dicts containing keys
|
||||
inline_scripts: {inline_scripts} #list of strs (filenames)
|
||||
|
||||
about_legal_tos: {about_legal_tos}
|
||||
about_legal_privacy: {about_legal_privacy}
|
||||
|
||||
authentication_enable: {authentication_enable}
|
||||
|
||||
presentation:
|
||||
max_categories: {max_categories}
|
||||
custom_colors: {custom_colors}
|
||||
|
||||
user_annotations:
|
||||
enable: {enable_users_annotations}
|
||||
type: {annotation_type}
|
||||
hosted_tiledb_array:
|
||||
db_uri: {db_uri}
|
||||
hosted_file_directory: {hosted_file_directory}
|
||||
local_file_csv:
|
||||
directory: {local_file_csv_directory}
|
||||
file: {local_file_csv_file}
|
||||
ontology:
|
||||
enable: {ontology_enabled}
|
||||
obo_location: {obo_location}
|
||||
|
||||
embeddings:
|
||||
names: {embedding_names}
|
||||
enable_reembedding: {enable_reembedding}
|
||||
|
||||
diffexp:
|
||||
enable: {enable_difexp}
|
||||
lfc_cutoff: {lfc_cutoff}
|
||||
top_n: {top_n}
|
||||
"""
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
f"""server:
|
||||
app:
|
||||
verbose: {verbose}
|
||||
debug: {debug}
|
||||
host: {host}
|
||||
port: {port}
|
||||
open_browser: {open_browser}
|
||||
force_https: {force_https}
|
||||
flask_secret_key: {flask_secret_key}
|
||||
generate_cache_control_headers: {generate_cache_control_headers}
|
||||
server_timing_headers: {server_timing_headers}
|
||||
csp_directives: {csp_directives}
|
||||
api_base_url: {api_base_url}
|
||||
web_base_url: {web_base_url}
|
||||
authentication:
|
||||
type: {auth_type}
|
||||
params_oauth:
|
||||
oauth_api_base_url: {oauth_api_base_url}
|
||||
client_id: {client_id}
|
||||
client_secret: {client_secret}
|
||||
jwt_decode_options: {jwt_decode_options}
|
||||
session_cookie: {session_cookie}
|
||||
cookie: {cookie}
|
||||
|
||||
multi_dataset:
|
||||
dataroot: {dataroot}
|
||||
index: {index}
|
||||
allowed_matrix_types: {allowed_matrix_types}
|
||||
matrix_cache:
|
||||
max_datasets: {max_cached_datasets}
|
||||
timelimit_s: {timelimit_s}
|
||||
|
||||
single_dataset:
|
||||
datapath: {dataset_datapath}
|
||||
obs_names: {obs_names}
|
||||
var_names: {var_names}
|
||||
about: {about}
|
||||
title: {title}
|
||||
|
||||
diffexp:
|
||||
alg_cxg: # number of threads to use is computed from: min(max_workers, cpu_multipler * cpu_count)
|
||||
max_workers: {diffexp_max_workers}
|
||||
cpu_multiplier: {cpu_multiplier}
|
||||
target_workunit: {target_workunit} # The target number of matrix elements that are evaluated in one thread.
|
||||
|
||||
data_locator:
|
||||
s3:
|
||||
region_name: {data_locater_region_name}
|
||||
|
||||
adaptor:
|
||||
cxg_adaptor:
|
||||
tiledb_ctx:
|
||||
sm.tile_cache_size: {cxg_tile_cache_size}
|
||||
sm.num_reader_threads: {cxg_num_reader_threads}
|
||||
|
||||
anndata_adaptor:
|
||||
backed: {anndata_backed}
|
||||
|
||||
limits:
|
||||
column_request_max: {column_request_max}
|
||||
diffexp_cellcount_max: {diffexp_cellcount_max}
|
||||
"""
|
||||
Reference in New Issue
Block a user