Coverage for sparkle/CLI/status.py: 96%
28 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-07 15:22 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-07 15:22 +0000
1#!/usr/bin/env python3
2"""Command to display the status of the platform."""
3import sys
4import argparse
6from sparkle.CLI.initialise import check_for_initialise
7from sparkle.CLI.help import global_variables as gv
8from sparkle.CLI.help import system_status as sssh
9from sparkle.CLI.help import logging as sl
10from sparkle.CLI.help import argparse_custom as ac
13def parser_function() -> argparse.ArgumentParser:
14 """Define the command line arguments."""
15 parser = argparse.ArgumentParser(description="Display the status of the platform.")
16 parser.add_argument(*ac.VerboseArgument.names,
17 **ac.VerboseArgument.kwargs)
18 return parser
21def main(argv: list[str]) -> None:
22 """Main function of the status command."""
23 # Log command call
24 sl.log_command(sys.argv)
25 check_for_initialise()
27 # Define command line arguments
28 parser = parser_function()
30 # Process command line arguments
31 args = parser.parse_args(argv)
33 print("Reporting current system status of Sparkle ...")
34 sssh.print_sparkle_list([s for s in gv.settings().DEFAULT_solver_dir.iterdir()],
35 "Solver", args.verbose)
36 sssh.print_sparkle_list([e for e in gv.settings().DEFAULT_extractor_dir.iterdir()],
37 "Extractor", args.verbose)
38 sssh.print_sparkle_list([i for i in gv.settings().DEFAULT_instance_dir.iterdir()],
39 "Instance Set", args.verbose)
41 sssh.print_feature_computation_jobs(
42 gv.settings().DEFAULT_feature_data_path, args.verbose
43 )
44 sssh.print_performance_computation_jobs(
45 gv.settings().DEFAULT_performance_data_path, args.verbose
46 )
48 # scan configurator log files for warnings
49 configurator = gv.settings().get_general_sparkle_configurator()
50 configurator.get_status_from_logs()
52 print("\nCurrent system status of Sparkle reported!")
53 sys.exit(0)
56if __name__ == "__main__":
57 main(sys.argv[1:])