Skip to content

Commit

Permalink
Add option --log-file and runtime parameter multiply-unions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannah Bast committed Jan 18, 2025
1 parent 752a35d commit 57fecee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/qlever/commands/extract_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def additional_arguments(self, subparser) -> None:
help="Base name for the query descriptions"
" (default: `Log extract`)",
)
subparser.add_argument(
"--log-file",
type=str,
help="Name of the log file to extract queries from"
" (default: `<name>.server-log.txt`)",
)
subparser.add_argument(
"--output-file",
type=str,
Expand All @@ -40,7 +46,10 @@ def additional_arguments(self, subparser) -> None:

def execute(self, args) -> bool:
# Show what the command does.
log_file_name = f"{args.name}.server-log.txt"
if args.log_file is not None:
log_file_name = args.log_file
else:
log_file_name = f"{args.name}.server-log.txt"
self.show(
f"Extract SPARQL queries from `{log_file_name}`"
f" and write them to `{args.output_file}`",
Expand Down Expand Up @@ -74,7 +83,9 @@ def execute(self, args) -> bool:
# A new query in the log.
if "Processing the following SPARQL query" in line:
query = []
query_index = description_base_count.get(description_base, 0) + 1
query_index = (
description_base_count.get(description_base, 0) + 1
)
description_base_count[description_base] = query_index
continue
# If we have started a query: extend until we meet the next log
Expand Down
1 change: 1 addition & 0 deletions src/qlever/commands/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def relevant_qleverfile_arguments(self) -> dict[str : list[str]]:

def additional_arguments(self, subparser) -> None:
all_keys = [
"always-multiply-unions",
"cache-max-num-entries",
"cache-max-size",
"cache-max-size-single-entry",
Expand Down

0 comments on commit 57fecee

Please sign in to comment.