qlever 0.5.31__py3-none-any.whl → 0.5.32__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of qlever might be problematic. Click here for more details.
- qlever/commands/settings.py +55 -61
- qlever/commands/start.py +24 -4
- qlever/qleverfile.py +29 -0
- {qlever-0.5.31.dist-info → qlever-0.5.32.dist-info}/METADATA +1 -1
- {qlever-0.5.31.dist-info → qlever-0.5.32.dist-info}/RECORD +9 -9
- {qlever-0.5.31.dist-info → qlever-0.5.32.dist-info}/WHEEL +0 -0
- {qlever-0.5.31.dist-info → qlever-0.5.32.dist-info}/entry_points.txt +0 -0
- {qlever-0.5.31.dist-info → qlever-0.5.32.dist-info}/licenses/LICENSE +0 -0
- {qlever-0.5.31.dist-info → qlever-0.5.32.dist-info}/top_level.txt +0 -0
qlever/commands/settings.py
CHANGED
|
@@ -6,6 +6,7 @@ from termcolor import colored
|
|
|
6
6
|
|
|
7
7
|
from qlever.command import QleverCommand
|
|
8
8
|
from qlever.log import log
|
|
9
|
+
from qlever.qleverfile import Qleverfile
|
|
9
10
|
from qlever.util import run_command
|
|
10
11
|
|
|
11
12
|
|
|
@@ -27,39 +28,15 @@ class SettingsCommand(QleverCommand):
|
|
|
27
28
|
return {"server": ["port", "host_name", "access_token"]}
|
|
28
29
|
|
|
29
30
|
def additional_arguments(self, subparser) -> None:
|
|
30
|
-
all_keys = [
|
|
31
|
-
"always-multiply-unions",
|
|
32
|
-
"cache-max-num-entries",
|
|
33
|
-
"cache-max-size",
|
|
34
|
-
"cache-max-size-single-entry",
|
|
35
|
-
"cache-service-results",
|
|
36
|
-
"default-query-timeout",
|
|
37
|
-
"division-by-zero-is-undef",
|
|
38
|
-
"enable-prefilter-on-index-scans",
|
|
39
|
-
"group-by-disable-index-scan-optimizations",
|
|
40
|
-
"group-by-hash-map-enabled",
|
|
41
|
-
"lazy-index-scan-max-size-materialization",
|
|
42
|
-
"lazy-index-scan-num-threads",
|
|
43
|
-
"lazy-index-scan-queue-size",
|
|
44
|
-
"lazy-result-max-cache-size",
|
|
45
|
-
"query-planning-budget",
|
|
46
|
-
"request-body-limit",
|
|
47
|
-
"service-max-redirects",
|
|
48
|
-
"service-max-value-rows",
|
|
49
|
-
"sort-estimate-cancellation-factor",
|
|
50
|
-
"spatial-join-prefilter-max-size",
|
|
51
|
-
"spatial-join-max-num-threads",
|
|
52
|
-
"syntax-test-mode",
|
|
53
|
-
"throw-on-unbound-variables",
|
|
54
|
-
"treat-default-graph-as-named-graph",
|
|
55
|
-
"use-binsearch-transitive-path",
|
|
56
|
-
]
|
|
57
31
|
subparser.add_argument(
|
|
58
|
-
"
|
|
59
|
-
nargs="
|
|
60
|
-
help="
|
|
61
|
-
"
|
|
62
|
-
|
|
32
|
+
"runtime_parameters",
|
|
33
|
+
nargs="*",
|
|
34
|
+
help="Space-separated list of runtime parameters to set "
|
|
35
|
+
"in the form `key=value`; afterwards shows all settings, "
|
|
36
|
+
"with the changed ones highlighted",
|
|
37
|
+
).completer = lambda **kwargs: [
|
|
38
|
+
f"{key}=" for key in Qleverfile.SERVER_RUNTIME_PARAMETERS
|
|
39
|
+
]
|
|
63
40
|
subparser.add_argument(
|
|
64
41
|
"--endpoint_url",
|
|
65
42
|
type=str,
|
|
@@ -74,48 +51,65 @@ class SettingsCommand(QleverCommand):
|
|
|
74
51
|
else:
|
|
75
52
|
endpoint_url = f"http://{args.host_name}:{args.port}"
|
|
76
53
|
|
|
77
|
-
# Construct the `curl`
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
54
|
+
# Construct the `curl` commands for setting and getting.
|
|
55
|
+
curl_cmds_setting = []
|
|
56
|
+
keys_set = set()
|
|
57
|
+
if args.runtime_parameters:
|
|
58
|
+
for key_value_pair in args.runtime_parameters:
|
|
59
|
+
try:
|
|
60
|
+
key, value = key_value_pair.split("=")
|
|
61
|
+
except ValueError:
|
|
62
|
+
log.error("Runtime parameter must be given as `key=value`")
|
|
63
|
+
return False
|
|
64
|
+
curl_cmds_setting.append(
|
|
65
|
+
f"curl -s {endpoint_url} -w %{{http_code}}"
|
|
66
|
+
f' --data-urlencode "{key}={value}"'
|
|
67
|
+
f' --data-urlencode "access-token={args.access_token}"'
|
|
82
68
|
)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
else:
|
|
93
|
-
curl_cmd = (
|
|
94
|
-
f"curl -s {endpoint_url}" f" --data-urlencode cmd=get-settings"
|
|
95
|
-
)
|
|
96
|
-
parameter_key, parameter_value = None, None
|
|
97
|
-
self.show(curl_cmd, only_show=args.show)
|
|
69
|
+
keys_set.add(key)
|
|
70
|
+
curl_cmd_getting = (
|
|
71
|
+
f"curl -s {endpoint_url} -w %{{http_code}}"
|
|
72
|
+
f" --data-urlencode cmd=get-settings"
|
|
73
|
+
)
|
|
74
|
+
self.show(
|
|
75
|
+
"\n".join(curl_cmds_setting + [curl_cmd_getting]),
|
|
76
|
+
only_show=args.show,
|
|
77
|
+
)
|
|
98
78
|
if args.show:
|
|
99
79
|
return True
|
|
100
80
|
|
|
101
|
-
# Execute the `curl`
|
|
102
|
-
|
|
103
|
-
|
|
81
|
+
# Execute the `curl` commands for setting the key-value pairs if any.
|
|
82
|
+
for curl_cmd in curl_cmds_setting:
|
|
83
|
+
try:
|
|
84
|
+
curl_result = run_command(curl_cmd, return_output=True)
|
|
85
|
+
body, http_code = curl_result[:-3], curl_result[-3:]
|
|
86
|
+
if http_code != "200":
|
|
87
|
+
raise Exception(body)
|
|
88
|
+
except Exception as e:
|
|
89
|
+
log.error(
|
|
90
|
+
f"curl command for setting key-value pair failed: {e}"
|
|
91
|
+
)
|
|
92
|
+
return False
|
|
93
|
+
|
|
94
|
+
# Execute the `curl` commands for getting the settings.
|
|
104
95
|
try:
|
|
105
|
-
|
|
106
|
-
|
|
96
|
+
curl_result = run_command(curl_cmd_getting, return_output=True)
|
|
97
|
+
body, http_code = curl_result[:-3], curl_result[-3:]
|
|
98
|
+
if http_code != "200":
|
|
99
|
+
raise Exception(body)
|
|
100
|
+
settings_dict = json.loads(body)
|
|
107
101
|
if isinstance(settings_dict, list):
|
|
108
102
|
settings_dict = settings_dict[0]
|
|
109
103
|
except Exception as e:
|
|
110
|
-
log.error(f"
|
|
104
|
+
log.error(f"curl command for getting settings failed: {e}")
|
|
111
105
|
return False
|
|
112
106
|
for key, value in settings_dict.items():
|
|
113
107
|
print(
|
|
114
108
|
colored(
|
|
115
109
|
f"{key:<45}: {value}",
|
|
116
|
-
"blue"
|
|
117
|
-
if parameter_key and key == parameter_key
|
|
118
|
-
else None,
|
|
110
|
+
"blue" if key in keys_set else None,
|
|
119
111
|
)
|
|
120
112
|
)
|
|
113
|
+
|
|
114
|
+
# That's it.
|
|
121
115
|
return True
|
qlever/commands/start.py
CHANGED
|
@@ -5,11 +5,13 @@ import time
|
|
|
5
5
|
|
|
6
6
|
from qlever.command import QleverCommand
|
|
7
7
|
from qlever.commands.cache_stats import CacheStatsCommand
|
|
8
|
+
from qlever.commands.settings import SettingsCommand
|
|
8
9
|
from qlever.commands.status import StatusCommand
|
|
9
10
|
from qlever.commands.stop import StopCommand
|
|
10
11
|
from qlever.commands.warmup import WarmupCommand
|
|
11
12
|
from qlever.containerize import Containerize
|
|
12
13
|
from qlever.log import log
|
|
14
|
+
from qlever.qleverfile import Qleverfile
|
|
13
15
|
from qlever.util import binary_exists, is_qlever_server_alive, run_command
|
|
14
16
|
|
|
15
17
|
|
|
@@ -165,8 +167,19 @@ class StartCommand(QleverCommand):
|
|
|
165
167
|
help="Run the server in the foreground "
|
|
166
168
|
"(default: run in the background with `nohup`)",
|
|
167
169
|
)
|
|
170
|
+
subparser.add_argument(
|
|
171
|
+
"runtime_parameters",
|
|
172
|
+
nargs="*",
|
|
173
|
+
help="Space-separated list of runtime parameters to set "
|
|
174
|
+
"(in the form `key=value`) once the server is running",
|
|
175
|
+
).completer = lambda **kwargs: [
|
|
176
|
+
f"{key}=" for key in Qleverfile.SERVER_RUNTIME_PARAMETERS
|
|
177
|
+
]
|
|
168
178
|
|
|
169
179
|
def execute(self, args) -> bool:
|
|
180
|
+
# Set the endpoint URL.
|
|
181
|
+
args.endpoint_url = f"http://{args.host_name}:{args.port}"
|
|
182
|
+
|
|
170
183
|
# Kill existing server with the same name if so desired.
|
|
171
184
|
#
|
|
172
185
|
# TODO: This is currently disabled because I never used it once over
|
|
@@ -200,6 +213,9 @@ class StartCommand(QleverCommand):
|
|
|
200
213
|
# Show the command line.
|
|
201
214
|
self.show(start_cmd, only_show=args.show)
|
|
202
215
|
if args.show:
|
|
216
|
+
if args.runtime_parameters:
|
|
217
|
+
log.info("")
|
|
218
|
+
SettingsCommand().execute(args)
|
|
203
219
|
return True
|
|
204
220
|
|
|
205
221
|
# When running natively, check if the binary exists and works.
|
|
@@ -208,9 +224,8 @@ class StartCommand(QleverCommand):
|
|
|
208
224
|
return False
|
|
209
225
|
|
|
210
226
|
# Check if a QLever server is already running on this port.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
log.error(f"QLever server already running on {endpoint_url}")
|
|
227
|
+
if is_qlever_server_alive(args.endpoint_url):
|
|
228
|
+
log.error(f"QLever server already running on {args.endpoint_url}")
|
|
214
229
|
log.info("")
|
|
215
230
|
log.info(
|
|
216
231
|
"To kill the existing server, use `qlever stop` "
|
|
@@ -269,7 +284,7 @@ class StartCommand(QleverCommand):
|
|
|
269
284
|
log.info("")
|
|
270
285
|
tail_cmd = f"exec tail -f {args.name}.server-log.txt"
|
|
271
286
|
tail_proc = subprocess.Popen(tail_cmd, shell=True)
|
|
272
|
-
while not is_qlever_server_alive(endpoint_url):
|
|
287
|
+
while not is_qlever_server_alive(args.endpoint_url):
|
|
273
288
|
time.sleep(1)
|
|
274
289
|
|
|
275
290
|
# Set the description for the index and text.
|
|
@@ -305,6 +320,11 @@ class StartCommand(QleverCommand):
|
|
|
305
320
|
args.server_url = None
|
|
306
321
|
CacheStatsCommand().execute(args)
|
|
307
322
|
|
|
323
|
+
# Apply settings if any.
|
|
324
|
+
if args.runtime_parameters:
|
|
325
|
+
log.info("")
|
|
326
|
+
SettingsCommand().execute(args)
|
|
327
|
+
|
|
308
328
|
# With `--run-in-foreground`, wait until the server is stopped.
|
|
309
329
|
if args.run_in_foreground:
|
|
310
330
|
try:
|
qlever/qleverfile.py
CHANGED
|
@@ -21,6 +21,35 @@ class Qleverfile:
|
|
|
21
21
|
Qleverfile + functions for parsing.
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
|
+
# Runtime parameters (for `settings` and `start` commands).
|
|
25
|
+
SERVER_RUNTIME_PARAMETERS = [
|
|
26
|
+
"always-multiply-unions",
|
|
27
|
+
"cache-max-num-entries",
|
|
28
|
+
"cache-max-size",
|
|
29
|
+
"cache-max-size-single-entry",
|
|
30
|
+
"cache-service-results",
|
|
31
|
+
"default-query-timeout",
|
|
32
|
+
"division-by-zero-is-undef",
|
|
33
|
+
"enable-prefilter-on-index-scans",
|
|
34
|
+
"group-by-disable-index-scan-optimizations",
|
|
35
|
+
"group-by-hash-map-enabled",
|
|
36
|
+
"lazy-index-scan-max-size-materialization",
|
|
37
|
+
"lazy-index-scan-num-threads",
|
|
38
|
+
"lazy-index-scan-queue-size",
|
|
39
|
+
"lazy-result-max-cache-size",
|
|
40
|
+
"query-planning-budget",
|
|
41
|
+
"request-body-limit",
|
|
42
|
+
"service-max-redirects",
|
|
43
|
+
"service-max-value-rows",
|
|
44
|
+
"sort-estimate-cancellation-factor",
|
|
45
|
+
"spatial-join-prefilter-max-size",
|
|
46
|
+
"spatial-join-max-num-threads",
|
|
47
|
+
"syntax-test-mode",
|
|
48
|
+
"throw-on-unbound-variables",
|
|
49
|
+
"treat-default-graph-as-named-graph",
|
|
50
|
+
"use-binsearch-transitive-path",
|
|
51
|
+
]
|
|
52
|
+
|
|
24
53
|
@staticmethod
|
|
25
54
|
def all_arguments():
|
|
26
55
|
"""
|
|
@@ -4,7 +4,7 @@ qlever/config.py,sha256=gNw2_-jj1TjzhzqLOuUI_Dh19q_ViCiArrtrgXL2F4E,10354
|
|
|
4
4
|
qlever/containerize.py,sha256=G1_ei9nBnYl5-7miiy0eWjb9HMnt06X21P7iU8bm6A0,5369
|
|
5
5
|
qlever/log.py,sha256=WLscWV4fFF_w_uXSOfvWzhyzRM7t_61inE2ks3zf6Gw,1317
|
|
6
6
|
qlever/qlever_main.py,sha256=QlVXq7azyuAG0QhH_pER2fdZL8el2mG0I6d9r0dGgOA,2593
|
|
7
|
-
qlever/qleverfile.py,sha256=
|
|
7
|
+
qlever/qleverfile.py,sha256=l8zySDMdUcYf80e8iXr7JMtre0_tvBDAtZIzCyPqSNs,19644
|
|
8
8
|
qlever/util.py,sha256=n4sJoBCrCSVaDS20z5B5tfa5GMqo3vGOdn5D1efjkmY,10940
|
|
9
9
|
qlever/Qleverfiles/Qleverfile.dblp,sha256=G-sus-3SKHxXU1ZwevjzAXmosdJfLeOSb4SYmkjHY4o,1247
|
|
10
10
|
qlever/Qleverfiles/Qleverfile.dblp-plus,sha256=TJHxp8I1P6JKJjbuAllEpB32-huuY1gH0FlenqPVJ5g,1334
|
|
@@ -38,18 +38,18 @@ qlever/commands/index.py,sha256=f1mZ9QNJwmjPa0KGAPghrj4L5XnY1TAcgoZ2wWj-n3Y,1332
|
|
|
38
38
|
qlever/commands/index_stats.py,sha256=9EBo1Oq5PGjajrvWJNafJ-Wg_d90DaO5AGq9a5plSRM,11720
|
|
39
39
|
qlever/commands/log.py,sha256=vLqkgtx1udnQqoUBMWB5G9rwr-l7UKrDpyFYSMuoXWw,1987
|
|
40
40
|
qlever/commands/query.py,sha256=rRiR4TFRZixLfBmITAvKVtWHn6mhOiboGG8a_Jcwc8k,4653
|
|
41
|
-
qlever/commands/settings.py,sha256=
|
|
41
|
+
qlever/commands/settings.py,sha256=wG2M2U6xoxQTnvgEIPfmw-sP7LwLR0Ut--Yi1uCjE68,4002
|
|
42
42
|
qlever/commands/setup_config.py,sha256=wEy1LAunpOnqrUCbazMpt1u9HJCKgXJEMxF3zjh0jb0,3344
|
|
43
|
-
qlever/commands/start.py,sha256=
|
|
43
|
+
qlever/commands/start.py,sha256=ELNaZ1RtfLo0cwSxqjzyECFvFgETI8_psJO9hwFmVT8,11609
|
|
44
44
|
qlever/commands/status.py,sha256=TtnBqcdkF3zTDKft07zpVcIX7kFu7d_nOy9b6Ohh9vQ,1650
|
|
45
45
|
qlever/commands/stop.py,sha256=5BNKArOzoJ8kYiTVAmtN81w7nQ42fkxISgsxL-qJpO0,3463
|
|
46
46
|
qlever/commands/system_info.py,sha256=I84EKgMO5J8pvsTDhkVKHzsRLtPajNg9KTQN5kWjqLU,4660
|
|
47
47
|
qlever/commands/ui.py,sha256=Kjv5FKN0pjMCpJS6otbrczs364x24FAnsJjtnc98mJQ,9811
|
|
48
48
|
qlever/commands/update_wikidata.py,sha256=MQWNTe7KtadlTAsxCsntKYWZLSoX6H8l6WI4s6UfFqY,24484
|
|
49
49
|
qlever/commands/warmup.py,sha256=kJHzS7HJo8pD2CphJuaXDj_CYP02YDo2DVM-pun3A80,1029
|
|
50
|
-
qlever-0.5.
|
|
51
|
-
qlever-0.5.
|
|
52
|
-
qlever-0.5.
|
|
53
|
-
qlever-0.5.
|
|
54
|
-
qlever-0.5.
|
|
55
|
-
qlever-0.5.
|
|
50
|
+
qlever-0.5.32.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
51
|
+
qlever-0.5.32.dist-info/METADATA,sha256=jecvG6GmRKCOUmvTT3OOJd_ZwlhqymyLFdzbmIDCr_8,5151
|
|
52
|
+
qlever-0.5.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
53
|
+
qlever-0.5.32.dist-info/entry_points.txt,sha256=U_1U6SFIEZ-AnNlvk2nzcL0e4jnjEpuSbxYZ_E0XpEg,51
|
|
54
|
+
qlever-0.5.32.dist-info/top_level.txt,sha256=kd3zsYqiFd0--Czh5XTVkfEq6XR-XgRFW35X0v0GT-c,7
|
|
55
|
+
qlever-0.5.32.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|