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

If command was not successful, exit with code 1, ENHANCEMENTS #97

Merged
merged 7 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .github/workflows/qleverfiles-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- name: Check that all the files in `src/qlever/Qleverfiles` parse.
working-directory: ${{github.workspace}}/qlever-control
run: |
export QLEVER_ARGCOMPLETE_ENABLED=1
for QLEVERFILE in src/qlever/Qleverfiles/Qleverfile.*; do
echo
echo -e "\x1b[1;34mChecking ${QLEVERFILE}\x1b[0m"
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/Qleverfiles/Qleverfile.dblp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FORMAT = ttl

[index]
INPUT_FILES = *.gz
MULTI_INPUT_JSON = $$(ls *.gz | xargs -I {} echo '{ "cmd": "zcat {}" }')
MULTI_INPUT_JSON = { "cmd": "zcat {}", "for-each": "*.gz" }
SETTINGS_JSON = { "ascii-prefixes-only": false, "num-triples-per-batch": 5000000, "prefixes-external": [""] }

[server]
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/add_text_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def execute(self, args) -> bool:
# Show the command line.
self.show(add_text_index_cmd, only_show=args.show)
if args.show:
return False
return True

# When running natively, check if the binary exists and works.
if args.system == "native":
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/cache_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def execute(self, args) -> bool:
self.show("\n".join([cache_stats_cmd, cache_settings_cmd]),
only_show=args.show)
if args.show:
return False
return True

# Execute them.
try:
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/clear_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def execute(self, args) -> bool:
f"\"{args.access_token}\"")
self.show(clear_cache_cmd, only_show=args.show)
if args.show:
return False
return True

# Execute the command.
try:
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/example_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def execute(self, args) -> bool:
only_show=args.show,
)
if args.show:
return False
return True

# Get the example queries.
try:
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def execute(self, args) -> bool:
# Construct the command line and show it.
self.show(args.get_data_cmd, only_show=args.show)
if args.show:
return False
return True

# Execute the command line.
try:
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def execute(self, args) -> bool:
# Show the command line.
self.show(f"{settings_json_cmd}\n{index_cmd}", only_show=args.show)
if args.show:
return False
return True

# When running natively, check if the binary exists and works.
if args.system == "native":
Expand Down
4 changes: 1 addition & 3 deletions src/qlever/commands/index_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ def show_size(heading, size):
return True

def execute(self, args) -> bool:
ret_value = args.show

# The "time" part of the command.
if not args.only_space:
log_file_name = f"{args.name}.index-log.txt"
Expand All @@ -272,4 +270,4 @@ def execute(self, args) -> bool:
if not args.show:
ret_value &= self.execute_space(args)

return ret_value
return True
Copy link
Member

Choose a reason for hiding this comment

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

This breaks the command. The &= no longer work, because the variable is not defined before. The return values of execute_space and execute_time are also ignored.

2 changes: 1 addition & 1 deletion src/qlever/commands/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def execute(self, args) -> bool:
log_cmd += f" {log_file}"
self.show(log_cmd, only_show=args.show)
if args.show:
return False
return True

# Execute the command.
log.info(f"Follow log file {log_file}, press Ctrl-C to stop"
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def execute(self, args) -> bool:
f" --data-urlencode query={shlex.quote(args.query)}")
self.show(curl_cmd, only_show=args.show)
if args.show:
return False
return True

# Launch query.
try:
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/setup_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def execute(self, args) -> bool:
setup_config_cmd += "> Qleverfile"
self.show(setup_config_cmd, only_show=args.show)
if args.show:
return False
return True

# If there is already a Qleverfile in the current directory, exit.
qleverfile_path = Path("Qleverfile")
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def execute(self, args) -> bool:
# Show the command line.
self.show(start_cmd, only_show=args.show)
if args.show:
return False
return True

# When running natively, check if the binary exists and works.
if args.system == "native":
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 @@ -35,7 +35,7 @@ def execute(self, args) -> bool:
f"the command line matches {args.cmdline_regex}"
f" using Python's psutil library", only_show=args.show)
if args.show:
return False
return True

# Show the results as a table.
num_processes_found = 0
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def execute(self, args) -> bool:
f"\"{args.server_container}\"")
self.show(description, only_show=args.show)
if args.show:
return False
return True

# First check if there is container running and if yes, stop and remove
# it (unless the user has specified `--no-containers`).
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/system_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def execute(self, args) -> bool:
# Say what the command is doing.
self.show("Show system information and Qleverfile", only_show=args.show)
if args.show:
return False
return True

# Show system information.
show_heading("System Information")
Expand Down
4 changes: 3 additions & 1 deletion src/qlever/commands/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ def execute(self, args) -> bool:
"\n".join(["Stop running containers", pull_cmd, run_cmd, exec_cmd]),
only_show=args.show,
)
if qlever_is_running_in_container or args.show:
if qlever_is_running_in_container:
return False
if args.show:
return True

# Stop running containers.
for container_system in Containerize.supported_systems():
Expand Down
2 changes: 1 addition & 1 deletion src/qlever/commands/warmup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def execute(self, args) -> bool:
# Show what the command is doing.
self.show(args.warmup_cmd, only_show=args.show)
if args.show:
return False
return True

# Execute the command.
try:
Expand Down
Loading