Updated all CLIs

This commit is contained in:
Cyber MacGeddon 2025-05-03 10:16:53 +01:00
parent cd88efa332
commit d0cc173112
5 changed files with 13 additions and 19 deletions

View file

@ -142,6 +142,7 @@ async def run(running, **args):
de_q = asyncio.Queue(maxsize=10) de_q = asyncio.Queue(maxsize=10)
url = args["url"] url = args["url"]
flow_id = args["flow_id"]
load_task = asyncio.create_task( load_task = asyncio.create_task(
loader( loader(

View file

@ -195,12 +195,11 @@ def main():
p.load(args.files) p.load(args.files)
print("All done.") print("All done.")
break
except Exception as e: except Exception as e:
print("Exception:", e, flush=True) print("Exception:", e, flush=True)
main() main()

View file

@ -7,7 +7,6 @@ Loads Graph embeddings into TrustGraph processing.
import pulsar import pulsar
from pulsar.schema import JsonSchema from pulsar.schema import JsonSchema
from trustgraph.schema import Triples, Triple, Value, Metadata from trustgraph.schema import Triples, Triple, Value, Metadata
from trustgraph.schema import triples_store_queue
import argparse import argparse
import os import os
import time import time
@ -180,5 +179,6 @@ def main():
time.sleep(10) time.sleep(10)
main() print("Not implemented.")
#main()

View file

@ -6,34 +6,27 @@ Dump out TrustGraph processor states.
import requests import requests
import argparse import argparse
import tabulate
default_metrics_url = "http://localhost:8088/api/metrics" default_metrics_url = "http://localhost:8088/api/metrics"
def dump_status(url): def dump_status(url):
url = f"{url}/query?query=processor_state%7Bprocessor_state%3D%22running%22%7D" url = f"{url}/query?query=processor_info"
resp = requests.get(url) resp = requests.get(url)
obj = resp.json() obj = resp.json()
print(obj)
return
tbl = [ tbl = [
[ [
m["metric"]["job"], m["metric"]["job"],
"running" if int(m["value"][1]) > 0 else "down" "\U0001f49a"
] ]
for m in obj["data"]["result"] for m in obj["data"]["result"]
] ]
print(tabulate.tabulate( for row in tbl:
tbl, tablefmt="pretty", headers=["processor", "state"], print(f" {row[0]:30} {row[1]}")
stralign="left"
))
def main(): def main():

View file

@ -27,9 +27,7 @@ async def fetch_de(running, queue, user, collection, url):
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
de_url = f"{url}stream/document-embeddings" async with session.ws_connect(url) as ws:
async with session.ws_connect(de_url) as ws:
while running.get(): while running.get():
@ -117,11 +115,14 @@ async def run(running, **args):
q = asyncio.Queue() q = asyncio.Queue()
url = args["url"]
flow_id = args["flow_id"]
de_task = asyncio.create_task( de_task = asyncio.create_task(
fetch_de( fetch_de(
running=running, running=running,
queue=q, user=args["user"], collection=args["collection"], queue=q, user=args["user"], collection=args["collection"],
url=args["url"] + "api/v1/" url = f"{url}api/v1/flow/{flow_id}/export/document-embeddings"
) )
) )