This repository was archived by the owner on Jan 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnakefile
More file actions
155 lines (146 loc) · 6.48 KB
/
Snakefile
File metadata and controls
155 lines (146 loc) · 6.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
arangodb_install_dir = "/home/conceptnet/.arangodb"
arangodb_data_dir = f"{arangodb_install_dir}/data"
arangodb_exe = f"{arangodb_install_dir}/bin/arangodb"
benchmark_data_dir = "/home/conceptnet/benchmark_data"
conceptnet5_dir = "/home/conceptnet/conceptnet5"
conceptnet5_virtualenv = "/home/conceptnet/conceptnet5_virtualenv"
conceptnet5_postgresql_done = f"{conceptnet5_dir}/data/psql/done"
conceptnet5_python = f"{conceptnet5_virtualenv}/bin/python"
conceptnet5_snakemake = f"{conceptnet5_virtualenv}/bin/snakemake"
conceptnet_benchmark_dir = "/home/conceptnet/conceptnet-benchmark"
conceptnet_benchmark_exe = f"{conceptnet_benchmark_dir}/benchmark.py"
conceptnet_benchmark_data_generator = f"{conceptnet_benchmark_dir}/data_generator.py"
conceptnet_benchmark_tables_generator = f"{conceptnet_benchmark_dir}/generate_tables.py"
conceptnet_rocks_virtualenv = "/home/conceptnet/conceptnet_rocks_virtualenv"
conceptnet_rocks_python = f"{conceptnet_rocks_virtualenv}/bin/python"
conceptnet_rocks_exe = f"{conceptnet_rocks_virtualenv}/bin/conceptnet-rocks"
edge_count = f"--edge-count {config['edge_count']}" if config.get('edge_count') else ""
generate_data_exe = f"{conceptnet_benchmark_dir}/generate_data.fish"
results_dir = "/home/conceptnet/results"
system_requirements = f"{conceptnet_benchmark_dir}/system_requirements.py"
assertions_file = f"{conceptnet5_dir}/data/assertions/assertions.csv"
assertions_msgpack_file = f"{conceptnet5_dir}/data/assertions/assertions.msgpack"
benchmark_exe = f"{conceptnet_benchmark_dir}/run_benchmark.fish"
rule all:
input:
assertions_file,
assertions_msgpack_file,
conceptnet5_postgresql_done,
arangodb_data_dir,
f"{results_dir}/assertions_build.txt",
f"{results_dir}/conceptnet5_load_db.txt",
f"{results_dir}/conceptnet5_node_profile.txt",
f"{results_dir}/conceptnet5_relation_profile.txt",
f"{results_dir}/conceptnet5_source_profile.txt",
f"{results_dir}/conceptnet5_dataset_profile.txt",
f"{results_dir}/conceptnet5_edge_uri_profile.txt",
f"{results_dir}/conceptnet_rocks_load_db.txt",
f"{results_dir}/conceptnet_rocks_node_profile.txt",
f"{results_dir}/conceptnet_rocks_relation_profile.txt",
f"{results_dir}/conceptnet_rocks_source_profile.txt",
f"{results_dir}/conceptnet_rocks_dataset_profile.txt",
f"{results_dir}/conceptnet_rocks_edge_uri_profile.txt",
f"{results_dir}/Load database time.md",
f"{results_dir}/Load database RAM.md",
f"{results_dir}/Load database disk.md",
f"{results_dir}/Query time.md",
f"{results_dir}/Query RAM.md",
f"{results_dir}/Query disk.md"
rule prepare_assertions:
output:
assertions_file,
assertions_msgpack_file,
f"{results_dir}/assertions_build.txt"
shell:
"cd {conceptnet5_dir}; "
"set +u; source {conceptnet5_virtualenv}/bin/activate; set -u; "
"{conceptnet5_python} {system_requirements} {conceptnet5_snakemake} --snakefile {conceptnet5_dir}/Snakefile --resources 'ram=30' -j1 combine_assertions data/assertions/assertions.csv 2>{results_dir}/assertions_build.txt"
rule load_conceptnet5_database:
input:
assertions_msgpack_file
output:
conceptnet5_postgresql_done,
f"{results_dir}/conceptnet5_load_db.txt"
shell:
"cd {conceptnet5_dir}; "
"set +u; source {conceptnet5_virtualenv}/bin/activate; set -u; "
"{conceptnet5_python} {system_requirements} {conceptnet5_snakemake} --snakefile {conceptnet5_dir}/Snakefile --resources 'ram=30' -j1 load_db 2>{results_dir}/conceptnet5_load_db.txt"
rule install_arangodb:
output:
directory(arangodb_install_dir)
shell:
"{conceptnet_rocks_python} {conceptnet_rocks_exe} install-arangodb"
rule load_conceptnet_rocks_database:
input:
assertions_file,
arangodb_exe
output:
directory(arangodb_data_dir),
f"{results_dir}/conceptnet_rocks_load_db.txt"
shell:
"{conceptnet_rocks_python} {system_requirements} {conceptnet_rocks_exe} load {assertions_file} {edge_count} 2>{results_dir}/conceptnet_rocks_load_db.txt"
rule generate_random_data:
input:
arangodb_data_dir
output:
directory(benchmark_data_dir),
f"{benchmark_data_dir}/random_node.csv",
f"{benchmark_data_dir}/random_relation.csv",
f"{benchmark_data_dir}/random_source.csv",
f"{benchmark_data_dir}/random_dataset.csv",
f"{benchmark_data_dir}/random_edge_uri.csv"
shell:
generate_data_exe
rule benchmark_conceptnet5:
input:
f"{benchmark_data_dir}/random_node.csv",
f"{benchmark_data_dir}/random_relation.csv",
f"{benchmark_data_dir}/random_source.csv",
f"{benchmark_data_dir}/random_dataset.csv",
f"{benchmark_data_dir}/random_edge_uri.csv"
output:
f"{results_dir}/conceptnet5_node_profile.txt",
f"{results_dir}/conceptnet5_relation_profile.txt",
f"{results_dir}/conceptnet5_source_profile.txt",
f"{results_dir}/conceptnet5_dataset_profile.txt",
f"{results_dir}/conceptnet5_edge_uri_profile.txt"
shell:
"{benchmark_exe} conceptnet5"
rule benchmark_conceptnet_rocks:
input:
f"{benchmark_data_dir}/random_node.csv",
f"{benchmark_data_dir}/random_relation.csv",
f"{benchmark_data_dir}/random_source.csv",
f"{benchmark_data_dir}/random_dataset.csv",
f"{benchmark_data_dir}/random_edge_uri.csv"
output:
f"{results_dir}/conceptnet_rocks_node_profile.txt",
f"{results_dir}/conceptnet_rocks_relation_profile.txt",
f"{results_dir}/conceptnet_rocks_source_profile.txt",
f"{results_dir}/conceptnet_rocks_dataset_profile.txt",
f"{results_dir}/conceptnet_rocks_edge_uri_profile.txt"
shell:
"{benchmark_exe} conceptnet_rocks"
rule generate_tables:
input:
f"{results_dir}/conceptnet5_load_db.txt",
f"{results_dir}/conceptnet_rocks_load_db.txt",
f"{results_dir}/conceptnet5_node_profile.txt",
f"{results_dir}/conceptnet5_relation_profile.txt",
f"{results_dir}/conceptnet5_source_profile.txt",
f"{results_dir}/conceptnet5_dataset_profile.txt",
f"{results_dir}/conceptnet5_edge_uri_profile.txt",
f"{results_dir}/conceptnet_rocks_node_profile.txt",
f"{results_dir}/conceptnet_rocks_relation_profile.txt",
f"{results_dir}/conceptnet_rocks_source_profile.txt",
f"{results_dir}/conceptnet_rocks_dataset_profile.txt",
f"{results_dir}/conceptnet_rocks_edge_uri_profile.txt"
output:
f"{results_dir}/Load database time.md",
f"{results_dir}/Load database RAM.md",
f"{results_dir}/Load database disk.md",
f"{results_dir}/Query time.md",
f"{results_dir}/Query RAM.md",
f"{results_dir}/Query disk.md"
shell:
"{conceptnet_rocks_python} {conceptnet_benchmark_tables_generator}"