From 0284d15d4286d07ef06cf0fd1bdacd204f3f68a8 Mon Sep 17 00:00:00 2001 From: cl117 Date: Tue, 30 Jun 2026 16:18:50 -0600 Subject: [PATCH] skip clustering --- flask/cluster.py | 11 +++++++++++ flask/config.json | 14 +------------- flask/explorer.py | 3 ++- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/flask/cluster.py b/flask/cluster.py index 724e852..440d901 100644 --- a/flask/cluster.py +++ b/flask/cluster.py @@ -115,6 +115,17 @@ def uclust2clusters(): def update_clusters(): logger_.log('------------ Updating clusters ------------', True) + + # Re-read config (force a fresh load, not the value cached at import) so a + # flag set at runtime via /config is honored. When skip_clustering is set, + # skip the (very slow) uclust run and keep the clusters from the previous + # run -- update_index will leave the existing clusters_dump untouched. + config_manager._config = None + if config_manager.load_config().get('skip_clustering'): + logger_.log('******** skip_clustering=true: skipping uclust, reusing previous clusters ********', True) + logger_.log('------------ Clustering skipped (previous clusters kept) ------------\n', True) + return None + logger_.log('******** Query for sequences ********', True) sequences_response = query.query_sparql(sequence_query) logger_.log('******** Query for sequences complete ********', True) diff --git a/flask/config.json b/flask/config.json index a188e64..486899c 100644 --- a/flask/config.json +++ b/flask/config.json @@ -1,13 +1 @@ -{ - "uclust_identity": "0.8", - "elasticsearch_index_name": "part", - "pagerank_tolerance": "0.0001", - "elasticsearch_endpoint": "http://localhost:9200/", - "sparql_endpoint": "http://localhost:8890/sparql?", - "last_update_start": "none", - "last_update_end": "none", - "distributed_search": false, - "which_search": "vsearch", - "autoUpdateIndex": false, - "updateTimeInDays": "1" -} +{"uclust_identity": "0.8", "elasticsearch_index_name": "part", "pagerank_tolerance": "0.0001", "elasticsearch_endpoint": "http://localhost:9200/", "sparql_endpoint": "http://localhost:8890/sparql?", "last_update_start": "2026-06-30T15:42:11.762203", "last_update_end": "none", "distributed_search": false, "which_search": "vsearch", "autoUpdateIndex": false, "updateTimeInDays": "1", "skip_clustering": true} \ No newline at end of file diff --git a/flask/explorer.py b/flask/explorer.py index 56b0377..2166f9c 100644 --- a/flask/explorer.py +++ b/flask/explorer.py @@ -76,7 +76,8 @@ def update_index(): config_manager.save_update_start_time() clusters = cluster.update_clusters() - data_manager.save_clusters(clusters) + if clusters is not None: # None => skip_clustering, keep existing clusters_dump + data_manager.save_clusters(clusters) uri2rank = pagerank.update_pagerank() data_manager.save_uri2rank(uri2rank)