This commit is contained in:
hsafaei
2026-07-02 10:53:04 +03:30
parent 5768c86aaf
commit 52dab527a5
3 changed files with 500 additions and 387 deletions
+7 -6
View File
@@ -12,7 +12,7 @@ import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
from app.common.elastic_helper import ElasticHelper
from app.common.elastic_helper_async import ElasticHelper
from app.common.general_functions import *
from app.common.text_normalizer import TextNormalizer
from app.common.data_helper import DataHelper
@@ -81,7 +81,7 @@ async def pack_files_to_elastic(
# ----------------------------------------
# ---- packing by cpu_count --------------
cpu_count = 10
cpu_count = 8
list_process = []
x = len(list_input)
@@ -144,8 +144,7 @@ async def import_data_from_json(file, index_name, file_jumps, host, password) ->
previous_info = item["previous_info"]
next_info = item["next_info"]
# version_key = item["version_key"]
version_key = "su-gemma4_cd-ri-urmind_e-qwen3.6_285k_group_v3-2"
version_key = item["version_key"]
subject_unity = item["subject_unity"]
if subject_unity["main_type"] == "no":
@@ -200,13 +199,14 @@ async def import_data_from_json(file, index_name, file_jumps, host, password) ->
if len(bulk_data) > 200:
# total_count += len(bulk_data)
# print("=" * 10, "to_elastic , total=" + str(total_count) + " -- " + str(total_import))
elastic.importBulkList(bulk_data, index_name)
await elastic.importBulkList(bulk_data, index_name)
bulk_data = []
if len(bulk_data) > 0:
# total_count += len(bulk_data)
# print("=" * 10, "to_elastic , total=" + str(total_count) + " -- " + str(total_import))
elastic.importBulkList(bulk_data, index_name)
await elastic.importBulkList(bulk_data, index_name)
bulk_data = []
@@ -214,6 +214,7 @@ async def import_data_from_json(file, index_name, file_jumps, host, password) ->
f.write("\n"+file)
# total_import += total_count
await elastic.es.close()
time1 = datetime.datetime.now().timestamp()
time = time1 - time
print("✅", file_name, ":", time)