This commit is contained in:
hsafaei
2026-07-01 19:29:56 +03:30
parent 60287c726c
commit 9ad8aeee13
+13 -9
View File
@@ -47,10 +47,10 @@ def get_evaluation_data(data):
## -----------------------------------------------------------------------
def run_to_procssing(list_files, out_put_index_name):
def run_to_procssing(list_files, out_put_index_name, host, password):
results = []
for file in list_files:
result = asyncio.run(import_from_json(file, out_put_index_name))
result = asyncio.run(import_from_json(file, out_put_index_name, host, password))
results.append(result)
return results
@@ -121,15 +121,19 @@ async def import_from_json(file, out_put_index_name, host, password) -> list:
print("▶️", file_name)
elastic = ElasticHelper(
es_url=f"http://{host}:6900", es_pass=password, es_user="elastic"
es_url=host, es_pass=password, es_user="elastic"
)
data_all = []
try:
with open(file, "r") as rfile:
with open(file, "rb") as rfile:
data_all = json.loads(rfile.read())
except:
print("not read file {file}")
data_all = data_all[0]
if data_all[0] and isinstance(data_all[0], list):
data_all = data_all[0]
except Exception as e:
print(f"not read file {file}", str(e))
bulk_data = []
failed_data = []
total_count = 0
@@ -986,9 +990,9 @@ if __name__ == "__main__":
# elastic.es.close()
input_path = r"G:\Project2\102_gpu\v3_conflict\285k_group_v3"
file_jumps = r"G:\Project2\102_gpu\v3_conflict\285k_group_v3_jump_ids.json"
file_jumps = r"G:\Project2\102_gpu\v3_conflict\285k_group_v3_jump_files.json"
asyncio.run(
import_conflict_to_elastic(
input_path, "mj_qa_conflict", file_jumps, host, password
input_path, "mj_qa_conflict_2", file_jumps, host, password
)
)