Skip to content

Commit

Permalink
better retry routine
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefal committed Jun 14, 2024
1 parent a8f39e1 commit c850197
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tools/sept_tool.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#! /usr/bin/env python3

import os
import sys
import argparse
from septentrio.septentrio_cmd import *
from enum import Enum
Expand All @@ -24,7 +26,7 @@ def arg_parse():
parser.add_argument("-c", "--command", nargs='+', help="Command to send to the gnss receiver", type=str)
parser.add_argument("-s", "--store", action='store_true', help="Store settings as permanent", default=False)
parser.add_argument("-r", "--retry", help="set a number of retry if the command fails", default=0, type=int)
parser.add_argument("--version", action="version", version="%(prog)s 0.1")
parser.add_argument("--version", action="version", version="%(prog)s 1.0")
args = parser.parse_args()
#print(args)
return args
Expand All @@ -47,5 +49,8 @@ def arg_parse():
break
except:
retries += 1
print("Retrying in {}s".format(retry_delay))
time.sleep(retry_delay)
print("Failed...retrying in {}s".format(retry_delay))
time.sleep(retry_delay)
if retries > args.retry:
print("Command failed!")
sys.exit(1)

0 comments on commit c850197

Please sign in to comment.