Skip to content

Commit 3fd8e5f

Browse files
starting template query install
1 parent 9c71846 commit 3fd8e5f

File tree

2 files changed

+50
-17
lines changed

2 files changed

+50
-17
lines changed

tests/run.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
clear
22
python3 test/setup.py &&
3-
python3 test/baseline/create_baselines.py &&
4-
pytest test/test_centrality.py #test/test_ml.py
5-
echo
3+
# python3 test/baseline/create_baselines.py &&
4+
# pytest test/test_centrality.py #test/test_ml.py
5+
echo 'done'

tests/test/setup.py

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,25 @@ def get_query_path(q_name):
3232
return pth[0]
3333

3434

35+
def get_template_queries() -> list[str]:
36+
paths = []
37+
packages = []
38+
for p in glob(f"../GDBMS_ALGO/**/*.gsql", recursive=True):
39+
name = p.replace("../", "").split(".")[0].split("/")
40+
pkg = ".".join(x for x in name[:-1])
41+
name = ".".join(x for x in name)
42+
if ".degree_cent" not in name:
43+
continue
44+
paths.append((name, p))
45+
packages.append(pkg)
46+
47+
packages = set(packages)
48+
return packages, paths
49+
50+
3551
if __name__ == "__main__":
52+
# print(get_template_queries())
53+
# exit(0)
3654
host_name = os.environ["HOST_NAME"]
3755
user_name = os.environ["USER_NAME"]
3856
password = os.environ["PASS"]
@@ -42,11 +60,11 @@ def get_query_path(q_name):
4260
password=password,
4361
graphname=graph_name,
4462
)
45-
print("checking ping")
4663
res = conn.ping()
47-
print(res)
64+
print(f"ping -1 {res}")
4865
if res["error"]:
4966
exit(1)
67+
5068
# load the data
5169
# dataset = Datasets("Cora")
5270
# add_reverse_edge(dataset)
@@ -59,18 +77,33 @@ def get_query_path(q_name):
5977
conn.graphname = graph_name
6078
# install the queries
6179
feat = conn.gds.featurizer() # type: ignore
62-
installed_queries = util.get_installed_queries(conn)
63-
algos = json.dumps(feat.algo_dict, indent=1)
64-
queries = [
65-
m.split(": ")[1].replace('"', "").strip() for m in pattern.findall(algos)
66-
]
67-
68-
t = tqdm(queries, desc="installing GDS queries")
69-
for q in t:
80+
if False:
81+
installed_queries = util.get_installed_queries(conn)
82+
algos = json.dumps(feat.algo_dict, indent=1)
83+
queries = [
84+
m.split(": ")[1].replace('"', "").strip() for m in pattern.findall(algos)
85+
]
86+
87+
t = tqdm(queries, desc="installing GDS queries")
88+
for q in t:
89+
t.set_postfix({"query": q})
90+
pth = get_query_path(q)
91+
if q not in installed_queries:
92+
feat.installAlgorithm(q, pth)
93+
94+
print(conn.gsql("DROP FUNCTION GDBMS_ALGO.*"))
95+
packages, queries = get_template_queries()
96+
for p in packages:
97+
print(conn.gsql(f"CREATE PACKAGE {p}"))
98+
99+
t = tqdm(queries, desc="installing Template queries")
100+
for q, pth in t:
70101
t.set_postfix({"query": q})
71-
pth = get_query_path(q)
72-
if q not in installed_queries:
73-
feat.installAlgorithm(q, pth)
102+
with open(pth) as f:
103+
query = f.read()
104+
print(query)
105+
print(conn.gsql(f"{query}"))
106+
# feat.installAlgorithm(q, pth)
74107

75108
# for _ in trange(30, desc="Sleeping while data loads"):
76-
# time.sleep(1)
109+
# time.sleep(1)

0 commit comments

Comments
 (0)