Skip to content

Commit

Permalink
Catch exception during running, undying mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mflierm committed Oct 10, 2024
1 parent 641c5f7 commit afc9f91
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions amstrax/auto_processing/delete_live_stbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,25 @@ def main(args):

if args.loop_infinite:
while True:
runs_deleted = main(args)
sleep_time = 1 if runs_deleted else args.sleep_time
log.info(f"Sleeping for {args.sleep_time} seconds...")
time.sleep(args.sleep_time)
try:
runs_deleted = main(args)
sleep_time = 1 if runs_deleted else args.sleep_time
log.info(f"Sleeping for {args.sleep_time} seconds...")
time.sleep(args.sleep_time)
try:
except (KeyboardInterrupt, SystemExit):
raise
except Exception as fatal_error:
log.error(
f"Fatal warning:\tran into {fatal_error}. Try "
"logging error and restart loop"
)
try:
log_warning(f"Fatal warning:\tran into {fatal_error}", priority="error")
except Exception as warning_error:
log.error(f"Fatal warning:\tcould not log {warning_error}")
# This usually only takes a minute or two
time.sleep(60)
log.warning("Restarting run loop")
else:
main(args)

0 comments on commit afc9f91

Please sign in to comment.