An open source, non-profit web search engine
Start processing historical data on startup
Daoud Clarke16c26920997f
diff --git a/mwmbl/crawler/historical.py b/mwmbl/crawler/historical.pyindex 480e447..bc17635 100644--- a/mwmbl/crawler/historical.py+++ b/mwmbl/crawler/historical.py@@ -24,7 +24,6 @@ def run(index_path):get_batch_time = datetime.now()print("Get batch time", get_batch_time - start)batch = HashedBatch.parse_obj(batch_dict)- print("Batch", batch)create_historical_batch(batch)create_historical_time = datetime.now()print("Create historical time", create_historical_time - get_batch_time)diff --git a/mwmbl/main.py b/mwmbl/main.pyindex a9ea14b..c894a32 100644--- a/mwmbl/main.py+++ b/mwmbl/main.py@@ -1,11 +1,13 @@import argparseimport logging+from multiprocessing import Processimport pandas as pdimport uvicornfrom fastapi import FastAPIfrom starlette.middleware.cors import CORSMiddleware+from mwmbl.crawler import historicalfrom mwmbl.crawler.app import router as crawler_routerfrom mwmbl.tinysearchengine import searchfrom mwmbl.tinysearchengine.completer import Completer@@ -38,6 +40,9 @@ def run():except FileExistsError:print("Index already exists")+ historical_batch_process = Process(target=historical.run, args=(args.index,))+ historical_batch_process.start()+completer = Completer()with TinyIndex(item_factory=Document, index_path=args.index) as tiny_index: