Skip to content

Commit

Permalink
set drop_old to false and clean up comment out code
Browse files Browse the repository at this point in the history
  • Loading branch information
Lu Zhou authored and Lu Zhou committed Aug 20, 2024
1 parent 3856ff7 commit 1c1a893
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 34 deletions.
13 changes: 2 additions & 11 deletions eventual-consistency-service/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,9 @@ def consistency_status(
)
match ecc_method:
case SupportAIMethod.SUPPORTAI:
# if graphname in consistency_checkers:
# ecc = consistency_checkers[graphname]
# ecc_status = json.dumps(ecc.get_status())
# else:
# start_ecc_in_thread(graphname, conn)
background.add_task(supportai.run, graphname, conn)
# ecc_status = (
# f"Eventual consistency checker started for graph {graphname} {time.ctime()}"
# )
ecc_status = f"SupportAI initialization on {graphname} {time.ctime()}"

# LogWriter.info(f"Returning consistency status for {graphname}: {status}")

ecc_status = f"SupportAI initialization on {graphname} {time.ctime()}"
case SupportAIMethod.GRAPHRAG:
background.add_task(graphrag.run, graphname, conn)

Expand Down
2 changes: 1 addition & 1 deletion eventual-consistency-service/app/supportai/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async def init(
vector_field=milvus_config.get("vector_field", "document_vector"),
text_field=milvus_config.get("text_field", "document_content"),
vertex_field=vertex_field,
drop_old=True,
drop_old=False,
)

LogWriter.info(f"Initializing {name}")
Expand Down
29 changes: 7 additions & 22 deletions eventual-consistency-service/app/supportai/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ async def extract(
if len(desc[0]):
await embed_chan.put((v_id, v_id, "Entity"))
else:
# (v_id, content, index_name)
await embed_chan.put((v_id, desc[0], "Entity"))

await upsert_chan.put(
Expand Down Expand Up @@ -219,21 +218,13 @@ async def extract(
)

for edge in doc.relationships:
# logger.info(
# f"extract writes relates edge to upsert\n{edge.source.id} -({edge.type})-> {edge.target.id}"
# )
# upsert verts first to make sure their ID becomes an attr
# v_id = util.process_id(edge.type) # edge type
v_id = edge.type
# if len(v_id) == 0:
# continue
# desc = await get_vert_desc(conn, v_id, node)
if len(v_id) == 0:
continue
# embed "Relationship"
# if len(desc[0]):
await embed_chan.put((v_id, v_id, "Relationship"))
# else:
# # (v_id, content, index_name)
# await embed_chan.put((v_id, desc[0], "Relationship"))

await upsert_chan.put(
(
util.upsert_vertex, # func to call
Expand All @@ -242,7 +233,6 @@ async def extract(
"Relationship", # v_type
v_id,
{ # attrs
# "description": desc,
"epoch_added": int(time.time()),
},
),
Expand All @@ -251,7 +241,7 @@ async def extract(
v_id = util.process_id(edge.source.id) # source id
if len(v_id) == 0:
continue
# desc = await get_vert_desc(conn, v_id, edge.source)
desc = await get_vert_desc(conn, v_id, edge.source)
await upsert_chan.put(
(
util.upsert_vertex, # func to call
Expand All @@ -260,7 +250,7 @@ async def extract(
"Entity", # v_type
v_id,
{ # attrs
# "description": desc,
"description": desc,
"epoch_added": int(time.time()),
},
),
Expand All @@ -269,7 +259,7 @@ async def extract(
v_id = util.process_id(edge.target.id) # target id
if len(v_id) == 0:
continue
# desc = await get_vert_desc(conn, v_id, edge.target)
desc = await get_vert_desc(conn, v_id, edge.target)
await upsert_chan.put(
(
util.upsert_vertex, # func to call
Expand All @@ -278,7 +268,7 @@ async def extract(
"Entity", # v_type
v_id, # src_id
{ # attrs
# "description": desc,
"description": desc,
"epoch_added": int(time.time()),
},
),
Expand All @@ -295,9 +285,7 @@ async def extract(
util.process_id(edge.source.id), # src_id
"IS_HEAD_OF", # edgeType
"Relationship", # tgt_type
# util.process_id(edge.type), # tgt_id
edge.type, # tgt_id
# {"relation_type": edge.type}, # attributes
),
)
)
Expand All @@ -307,12 +295,10 @@ async def extract(
(
conn,
"Relationship", # src_type
# util.process_id(edge.type), # src_id
edge.type, # src_id
"HAS_TAIL", # edgeType
"Entity", # tgt_type
util.process_id(edge.target.id), # tgt_id
# {"relation_type": edge.type}, # attributes
),
)
)
Expand All @@ -329,7 +315,6 @@ async def extract(
"MENTIONS_RELATIONSHIP", # edge_type
"Relationship", # tgt_type
edge.type, # tgt_id
# None, # attributes
),
)
)

0 comments on commit 1c1a893

Please sign in to comment.