Skip to content

Commit

Permalink
Fix command example-queries (remove tmp files)
Browse files Browse the repository at this point in the history
The command `example-queries` needs a temporary file for each query
result. Due to a bug, only the last of these was deleted so far. Now all
of them are deleted, unless the log level is `DEBUG`.
  • Loading branch information
Hannah Bast committed Jun 29, 2024
1 parent ebbbb7c commit 338656d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/qlever/commands/example_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ def execute(self, args) -> bool:
except Exception as e:
error_msg = str(e)

# Remove the result file (unless in debug mode).
if args.log_level != "DEBUG":
Path(result_file).unlink(missing_ok=True)

# Print description, time, result in tabular form.
if (len(description) > 60):
description = description[:57] + "..."
Expand Down Expand Up @@ -262,6 +266,4 @@ def execute(self, args) -> bool:
log.info(colored("All queries failed", "red"))

# Return success (has nothing to do with how many queries failed).
if args.log_level != "DEBUG":
Path(result_file).unlink(missing_ok=True)
return True

0 comments on commit 338656d

Please sign in to comment.