1
This commit is contained in:
@@ -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 = []
|
results = []
|
||||||
for file in list_files:
|
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)
|
results.append(result)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
@@ -121,15 +121,19 @@ async def import_from_json(file, out_put_index_name, host, password) -> list:
|
|||||||
print("▶️", file_name)
|
print("▶️", file_name)
|
||||||
|
|
||||||
elastic = ElasticHelper(
|
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 = []
|
data_all = []
|
||||||
try:
|
try:
|
||||||
with open(file, "r") as rfile:
|
with open(file, "rb") as rfile:
|
||||||
data_all = json.loads(rfile.read())
|
data_all = json.loads(rfile.read())
|
||||||
except:
|
if data_all[0] and isinstance(data_all[0], list):
|
||||||
print("not read file {file}")
|
|
||||||
data_all = data_all[0]
|
data_all = data_all[0]
|
||||||
|
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"not read file {file}", str(e))
|
||||||
|
|
||||||
bulk_data = []
|
bulk_data = []
|
||||||
failed_data = []
|
failed_data = []
|
||||||
total_count = 0
|
total_count = 0
|
||||||
@@ -986,9 +990,9 @@ if __name__ == "__main__":
|
|||||||
# elastic.es.close()
|
# elastic.es.close()
|
||||||
|
|
||||||
input_path = r"G:\Project2\102_gpu\v3_conflict\285k_group_v3"
|
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(
|
asyncio.run(
|
||||||
import_conflict_to_elastic(
|
import_conflict_to_elastic(
|
||||||
input_path, "mj_qa_conflict", file_jumps, host, password
|
input_path, "mj_qa_conflict_2", file_jumps, host, password
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user