Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/end-to-end-test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ jobs:
export CPPFLAGS="-I/usr/local/opt/llvm@16/include"
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$(pwd)/build/conan_toolchain.cmake" -DUSE_PARALLEL=true -DRUN_EXPENSIVE_TESTS=false -DENABLE_EXPENSIVE_CHECKS=true -DCMAKE_CXX_COMPILER=clang++ -DADDITIONAL_COMPILER_FLAGS="-fexperimental-library" -DADDITIONAL_LINKER_FLAGS="-L$(brew --prefix llvm)/lib/c++"
source build/conanrun.sh
make -C build ServerMain IndexBuilderMain
make -C build qlever-server qlever-index

- name: Check that qlever binaries and qlever script are found and work
run: |
export PATH="$PATH:$(pwd)/qlever-code/build"
source qlever-code/build/conanrun.sh
ServerMain --help | head -3; echo "..."
IndexBuilderMain --help | head -3; echo "..."
qlever-server --help | head -3; echo "..."
qlever-index --help | head -3; echo "..."
qlever --help

- name: Test qlever script for olympics dataset, without Docker
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/end-to-end-test-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ jobs:
git pull
mkdir -p build && cd $_
cmake -DCMAKE_BUILD_TYPE=Release -DLOGLEVEL=INFO -DUSE_PARALLEL=true -GNinja ..
ninja ServerMain IndexBuilderMain
ninja qlever-server qlever-index
docker pull adfreiburg/qlever

- name: Check that qlever binaries, docker image, and qlever script are found and work
run: |
mkdir qlever-indices
export PATH="$PATH:$(pwd)/qlever-control:$(pwd)/qlever-code/build"
docker run --entrypoint bash adfreiburg/qlever -c "ServerMain --help" | head -3
docker run --entrypoint bash adfreiburg/qlever -c "IndexBuilderMain --help" | head -3
ServerMain --help | head -3; echo "..."
IndexBuilderMain --help | head -3; echo "..."
docker run --entrypoint bash adfreiburg/qlever -c "qlever-server --help" | head -3
docker run --entrypoint bash adfreiburg/qlever -c "qlever-index --help" | head -3
qlever-server --help | head -3; echo "..."
qlever-index --help | head -3; echo "..."
qlever --help

- name: Test qlever script for olympics dataset, with docker
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "qlever"
description = "Command-line tool for using the QLever graph database"
version = "0.5.43"
version = "0.5.44"
authors = [
{ name = "Hannah Bast", email = "bast@cs.uni-freiburg.de" }
]
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/Qleverfiles/Qleverfile.default
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ACCESS_TOKEN =

# Use SYSTEM = docker to run QLever inside a docker container; the Docker image
# will be downloaded automatically. Use SYSTEM = native to use self-compiled
# binaries `IndexBuilderMain` and `ServerMain` (which should be in you PATH).
# binaries `qlever-index` and `qlever-server` (which should be in you PATH).
[runtime]
SYSTEM = docker
IMAGE = docker.io/adfreiburg/qlever:latest
Expand Down
11 changes: 2 additions & 9 deletions src/qlever/commands/add_text_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from qlever.command import QleverCommand
from qlever.containerize import Containerize
from qlever.log import log
from qlever.util import get_existing_index_files, run_command
from qlever.util import binary_exists, get_existing_index_files, run_command


class AddTextIndexCommand(QleverCommand):
Expand Down Expand Up @@ -82,14 +82,7 @@ def execute(self, args) -> bool:

# When running natively, check if the binary exists and works.
if args.system == "native":
try:
run_command(f"{args.index_binary} --help")
except Exception as e:
log.error(
f'Running "{args.index_binary}" failed ({e}), '
f"set `--index-binary` to a different binary or "
f"use `--container_system`"
)
if not binary_exists(args.index_binary, "index-binary"):
return False

# Check if text index files already exist.
Expand Down
6 changes: 3 additions & 3 deletions src/qlever/commands/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def construct_command(args) -> str:
# Kill existing server on the same port. Trust that StopCommand() works?
# Maybe return StopCommand().execute(args) and handle it with a try except?
def kill_existing_server(args) -> bool:
args.cmdline_regex = f"^ServerMain.* -p {args.port}"
args.cmdline_regex = f"^qlever-server.* -p {args.port}"
args.no_containers = True
if not StopCommand().execute(args):
log.error("Stopping the existing server failed")
Expand Down Expand Up @@ -185,7 +185,7 @@ def execute(self, args) -> bool:
# TODO: This is currently disabled because I never used it once over
# the past weeks and it is not clear to me what the use case is.
if False: # or args.kill_existing_with_same_name:
args.cmdline_regex = f"^ServerMain.* -i {args.name}"
args.cmdline_regex = f"^qlever-server.* -i {args.name}"
args.no_containers = True
StopCommand().execute(args)
log.info("")
Expand Down Expand Up @@ -234,7 +234,7 @@ def execute(self, args) -> bool:
)

# Show output of status command.
args.cmdline_regex = f"^ServerMain.* -p *{args.port}"
args.cmdline_regex = f"^qlever-server.* -p *{args.port}"
log.info("")
StatusCommand().execute(args)
return False
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def relevant_qleverfile_arguments(self) -> dict[str: list[str]]:

def additional_arguments(self, subparser) -> None:
subparser.add_argument("--cmdline-regex",
default="^(ServerMain|IndexBuilderMain)",
default="^(qlever-server|qlever-index)",
help="Show only processes where the command "
"line matches this regex")

Expand Down
4 changes: 2 additions & 2 deletions src/qlever/commands/stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def relevant_qleverfile_arguments(self) -> dict[str: list[str]]:

def additional_arguments(self, subparser) -> None:
subparser.add_argument("--cmdline-regex",
default="ServerMain.* -i [^ ]*%%NAME%%",
default="qlever-server.* -i [^ ]*%%NAME%%",
help="Show only processes where the command "
"line matches this regex")
subparser.add_argument("--no-containers", action="store_true",
Expand Down Expand Up @@ -84,7 +84,7 @@ def execute(self, args) -> bool:
message = "No matching process found" if args.no_containers else \
"No matching process or container found"
log.error(message)
args.cmdline_regex = "^ServerMain.* -i [^ ]*"
args.cmdline_regex = "^qlever-server.* -i [^ ]*"
log.info("")
StatusCommand().execute(args)
return True
10 changes: 10 additions & 0 deletions src/qlever/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,14 @@ def add_qleverfile_option(parser):
"arguments on the command line. This is possible, "
"but not recommended.")

# Warn if the old binary names are still being used.
if "IndexBuilderMain" in getattr(args, "index_binary", ""):
log.warning("The index binary has been renamed from "
"`IndexBuilderMain` to `qlever-index`. Please update "
"your Qleverfile or other configuration.")
if "ServerMain" in getattr(args, "server_binary", ""):
log.warning("The server binary has been renamed from "
"`ServerMain` to `qlever-server`. Please update "
"your Qleverfile or other configuration.")

return args
4 changes: 2 additions & 2 deletions src/qlever/qleverfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def arg(*args, **kwargs):
index_args["index_binary"] = arg(
"--index-binary",
type=str,
default="IndexBuilderMain",
default="qlever-index",
help="The binary for building the index (this requires "
"that you have compiled QLever on your machine)",
)
Expand Down Expand Up @@ -242,7 +242,7 @@ def arg(*args, **kwargs):
server_args["server_binary"] = arg(
"--server-binary",
type=str,
default="ServerMain",
default="qlever-server",
help="The binary for starting the server (this requires "
"that you have compiled QLever on your machine)",
)
Expand Down
8 changes: 8 additions & 0 deletions src/qlever/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@ def binary_exists(binary: str, cmd_arg: str) -> bool:
)
log.info("")
log.info(f"The error message was: {e}")
if binary == "qlever-index" or binary == "qlever-server":
log.info("")
log.warning(
f"This might be because you are using a newer version of "
f"the `qlever` command-line tool together with an older "
f"Docker image; in that case update with "
f"`docker pull adfreiburg/qlever` "
)
return False


Expand Down
2 changes: 1 addition & 1 deletion test/qlever/commands/test_start_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def test_execute_fails_due_to_existing_server(
args.kill_existing_with_same_port = False
args.port = "localhorst"
args.port = 1234
args.cmdline_regex = f"^ServerMain.* -p {args.port}"
args.cmdline_regex = f"^qlever-server.* -p {args.port}"
args.no_containers = True
args.server_binary = "/test/path/server_binary"
args.name = "TestName"
Expand Down
2 changes: 1 addition & 1 deletion test/qlever/commands/test_status_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def get_mock_args(only_show):
args = MagicMock()
args.cmdline_regex = "^(ServerMain|IndexBuilderMain)"
args.cmdline_regex = "^(qlever-server|qlever-index)"
args.show = only_show
return [args, args.cmdline_regex, args.show]

Expand Down
2 changes: 1 addition & 1 deletion test/qlever/commands/test_status_other_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_additional_arguments(self):
args = parser.parse_args([])

# Test that the default value is set correctly
self.assertEqual(args.cmdline_regex, "^(ServerMain|IndexBuilderMain)")
self.assertEqual(args.cmdline_regex, "^(qlever-server|qlever-index)")

# Test that the help text is correctly set
argument_help = subparser._group_actions[-1].help
Expand Down
14 changes: 7 additions & 7 deletions test/qlever/commands/test_stop_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_execute_no_matching_processes_or_containers(
):
# Setup args
args = MagicMock()
args.cmdline_regex = "ServerMain.* -i [^ ]*%%NAME%%"
args.cmdline_regex = "qlever-server.* -i [^ ]*%%NAME%%"
args.name = "TestName"
args.no_containers = True
args.server_container = "test_container"
Expand Down Expand Up @@ -61,7 +61,7 @@ def test_execute_with_matching_process(
):
# Setup args
args = MagicMock()
args.cmdline_regex = "ServerMain.* -i [^ ]*%%NAME%%"
args.cmdline_regex = "qlever-server.* -i [^ ]*%%NAME%%"
args.name = "TestName"
args.no_containers = True
args.server_container = "test_container"
Expand All @@ -75,7 +75,7 @@ def test_execute_with_matching_process(
# to test with real psutil.process objects use this:

mock_process.as_dict.return_value = {
"cmdline": ["ServerMain", "-i", "/some/path/TestName"],
"cmdline": ["qlever-server", "-i", "/some/path/TestName"],
"pid": 1234,
"username": "test_user",
}
Expand Down Expand Up @@ -115,7 +115,7 @@ def test_execute_with_containers(
):
# Setup args
args = MagicMock()
args.cmdline_regex = "ServerMain.* -i [^ ]*%%NAME%%"
args.cmdline_regex = "qlever-server.* -i [^ ]*%%NAME%%"
args.name = "TestName"
args.no_containers = False
args.server_container = "test_container"
Expand Down Expand Up @@ -157,7 +157,7 @@ def test_execute_with_no_containers_and_no_matching_process(
):
# Setup args
args = MagicMock()
args.cmdline_regex = "ServerMain.* -i [^ ]*%%NAME%%"
args.cmdline_regex = "qlever-server.* -i [^ ]*%%NAME%%"
args.name = "TestName"
args.no_containers = False
args.server_container = "test_container"
Expand Down Expand Up @@ -204,7 +204,7 @@ def test_execute_with_error_killing_process(
):
# Setup args
args = MagicMock()
args.cmdline_regex = "ServerMain.* -i [^ ]*%%NAME%%"
args.cmdline_regex = "qlever-server.* -i [^ ]*%%NAME%%"
args.name = "TestName"
args.no_containers = True
args.server_container = "test_container"
Expand All @@ -216,7 +216,7 @@ def test_execute_with_error_killing_process(
# Creating mock psutil.Process objects with necessary attributes
mock_process = MagicMock()
mock_process.as_dict.return_value = {
"cmdline": ["ServerMain", "-i", "/some/path/TestName"],
"cmdline": ["qlever-server", "-i", "/some/path/TestName"],
"pid": 1234,
"create_time": 1234567890,
"memory_info": MagicMock(rss=1024 * 1024 * 512),
Expand Down
2 changes: 1 addition & 1 deletion test/qlever/commands/test_stop_other_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_additional_arguments(self):
args = parser.parse_args([])

# Test that the default value for cmdline_regex is set correctly
self.assertEqual(args.cmdline_regex, "ServerMain.* -i [^ ]*%%NAME%%")
self.assertEqual(args.cmdline_regex, "qlever-server.* -i [^ ]*%%NAME%%")

# Test that the help text for cmdline_regex is correctly set
argument_help = subparser._group_actions[-2].help
Expand Down