Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many fixes and improvements + workflows pass again -> version 0.5.0 #31

Merged
merged 33 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0af2f05
Some fixes suggested by Stefan
Mar 26, 2024
9ccd486
Address suggestion by Julian + add first simple test
Mar 26, 2024
4903a64
Handle the case `pinfo[cmdline] == None` correctly
Mar 27, 2024
86c7369
Adapt command `index-stats` for new index log file format
Apr 1, 2024
39333f2
Make `example-queries` command much more powerful
Apr 9, 2024
a1b396e
Finishing this PR
Apr 13, 2024
0df8f84
Trying to get the end-to-end-test to run again
Apr 13, 2024
6a2bc0f
Have format check in own worflow + fix minor format errors
Apr 13, 2024
afafe8f
Use pip3 explicitly
Apr 13, 2024
5a0adeb
Upgrade pip, setuptools, wheel
Apr 13, 2024
cf33d99
qlever without arguments should return exit code 0
Apr 13, 2024
d552724
Disable native check for now + add timeout to steps
Apr 13, 2024
0d012de
Try the native index build once more (with new binaries)
Apr 13, 2024
2ef94ff
And now the macOS workflow
Apr 13, 2024
11850bc
Was in wrong working directory for pip install -e .
Apr 13, 2024
af95a54
Compile QLever from scratch and cache it
Apr 13, 2024
6cc8e29
Now let's see if the caches is actually used
Apr 13, 2024
3ce1ffb
New cache key
Apr 13, 2024
91a7921
Show output of `get-data` commands if any
Apr 13, 2024
87723b4
Add QLeverfile for daily update of OHM Planet
Apr 13, 2024
b8ef04f
First attempt to fix macOS workflow
Apr 13, 2024
0ee7305
Next try
Apr 13, 2024
2f72c89
Next round
Apr 14, 2024
e0cafb7
Try new hash key
Apr 14, 2024
aef6f45
A closer look
Apr 14, 2024
9acdba3
Una vez mas
Apr 14, 2024
840093c
Encore
Apr 14, 2024
ac64ac2
+=1
Apr 14, 2024
445d959
One step closer
Apr 14, 2024
52d8fc0
A real chance now
Apr 14, 2024
223d854
This might be it
Apr 14, 2024
8a35ca5
Cleanup the workflows
Apr 14, 2024
f0a5a89
Minor fix in Qleverfile for OHM Planet
Apr 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "qlever"
description = "Script for using the QLever SPARQL engine."
version = "0.4.0"
version = "0.4.1"
authors = [
{ name = "Hannah Bast", email = "[email protected]" }
]
Expand All @@ -16,7 +16,7 @@ classifiers = [
"Topic :: Database :: Front-Ends"
]

dependencies = [ "psutil", "termcolor" ]
dependencies = [ "psutil", "termcolor", "argcomplete" ]

[project.urls]
Github = "https://github.com/ad-freiburg/qlever-control"
Expand All @@ -28,4 +28,7 @@ Github = "https://github.com/ad-freiburg/qlever-control"
[tool.setuptools]
package-dir = { "" = "src" }
packages = [ "qlever", "qlever.commands", "qlever.Qleverfiles" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The layout qlever uses can automatically be discovered by setuptools. The two lines can be removed.

Suggested change
[tool.setuptools]
package-dir = { "" = "src" }
packages = [ "qlever", "qlever.commands", "qlever.Qleverfiles" ]
[tool.setuptools]

# package-data = { "qlever" = ["Qleverfiles/*"] }
package-data = { "qlever" = ["Qleverfiles/*"] }

[tool.pytest.ini_options]
pythonpath = ["src"]
3 changes: 3 additions & 0 deletions src/qlever/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import traceback
from pathlib import Path
from importlib.metadata import version

import argcomplete

Expand Down Expand Up @@ -180,6 +181,8 @@ def add_qleverfile_option(parser):
# are defined in the modules in `qlever/commands`. In `__init__.py`
# an object of each class is created and stored in `command_objects`.
parser = argparse.ArgumentParser()
parser.add_argument("--version", action="version",
version=f"%(prog)s {version('qlever')}")
add_qleverfile_option(parser)
subparsers = parser.add_subparsers(dest='command')
subparsers.required = True
Expand Down
14 changes: 7 additions & 7 deletions src/qlever/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import random
import secrets
import re
import shlex
import shutil
Expand Down Expand Up @@ -93,7 +93,7 @@ def get_curl_cmd_for_sparql_query(
"""
Get curl command for given SPARQL query.
"""
curl_cmd = (f"curl -s http::{host}:{port}"
curl_cmd = (f"curl -s http://{host}:{port}"
f" -H \"Accept: {media_type}\" "
f" --data-urlencode query={shlex.quote(query)}")
if pinresult and access_token is not None:
Expand Down Expand Up @@ -137,8 +137,9 @@ def show_table_line(pid, user, start_time, rss, cmdline):
pinfo = psutil_process.as_dict(
attrs=['pid', 'username', 'create_time',
'memory_info', 'cmdline'])
cmdline = " ".join(pinfo['cmdline'])
if not re.search(cmdline_regex, cmdline):
# Note: pinfo[`cmdline`] is `None` if the process is a zombie.
cmdline = " ".join(pinfo['cmdline'] or [])
if len(cmdline) == 0 or not re.search(cmdline_regex, cmdline):
return False
pid = pinfo['pid']
user = pinfo['username'] if pinfo['username'] else ""
Expand All @@ -162,6 +163,5 @@ def get_random_string(length: int) -> str:
Helper function that returns a randomly chosen string of the given
length. Take the current time as seed.
"""
random.seed(datetime.now())
return "".join(random.choices(string.ascii_letters + string.digits,
k=length))
characters = string.ascii_letters + string.digits
return "".join(secrets.choice(characters) for _ in range(length))
9 changes: 9 additions & 0 deletions test/qlever/test_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pytest
from qlever.util import get_random_string

def test_get_random_string():
random_string_1 = get_random_string(20)
random_string_2 = get_random_string(20)
assert len(random_string_1) == 20
assert len(random_string_2) == 20
assert random_string_1 != random_string_2
Loading