fixing progress bars with log files

This commit is contained in:
Mayeul Aubin 2025-03-17 13:54:54 +01:00
parent 32fa9a5afb
commit 942f775425
3 changed files with 23 additions and 2 deletions

View file

@ -14,7 +14,10 @@ def main_simbelmyne(parsed_args):
if parsed_args.execution == "local":
print_message("Running Simbelyne in local mode.", 1, "simbelmyne", verbose=parsed_args.verbose)
if isfile(log_file): # Remove the preexisting log file to allow for the progress_bar to be run normally
from os import remove
oremove(log_file)
command_args = ["simbelmyne", paramfile, log_file]
if parsed_args.verbose < 2:
@ -51,6 +54,10 @@ def main_simbelmyne(parsed_args):
command_args = ["sbatch", slurm_script]
if isfile(log_file): # Remove the preexisting log file to allow for the progress_bar to be run normally
from os import remove
oremove(log_file)
if parsed_args.verbose < 2:
subprocess.run(command_args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
else:
@ -75,7 +82,6 @@ if __name__ == "__main__":
from slurm_submission import register_arguments_slurm
parser = ArgumentParser(description="Run Simbelmyne.")
# TODO: reduce the volume of arguments
register_arguments_main(parser)
register_arguments_timestepping(parser)
register_arguments_simbelmyne(parser)