Add restart on fail

This commit is contained in:
Cyber MacGeddon 2024-07-17 21:32:53 +01:00
parent 29180216e6
commit 4e09ce75bc
3 changed files with 18 additions and 16 deletions

View file

@ -1,6 +1,6 @@
# VERSION=$(shell git describe | sed 's/^v//') # VERSION=$(shell git describe | sed 's/^v//')
VERSION=0.3.0 VERSION=0.3.1
all: container all: container

View file

@ -4,7 +4,7 @@ import os
with open("README.md", "r") as fh: with open("README.md", "r") as fh:
long_description = fh.read() long_description = fh.read()
version = "0.3.0" version = "0.3.1"
setuptools.setup( setuptools.setup(
name="trustgraph", name="trustgraph",

View file

@ -57,27 +57,29 @@ class BaseProcessor:
@classmethod @classmethod
def start(cls, prog, doc): def start(cls, prog, doc):
parser = argparse.ArgumentParser( while True:
prog=prog,
description=doc
)
cls.add_args(parser) parser = argparse.ArgumentParser(
prog=prog,
description=doc
)
args = parser.parse_args() cls.add_args(parser)
args = vars(args)
try: args = parser.parse_args()
args = vars(args)
p = cls(**args) try:
p.run()
except Exception as e: p = cls(**args)
p.run()
print("Exception:", e, flush=True) except Exception as e:
print("Will retry...", flush=True)
time.sleep(10) print("Exception:", e, flush=True)
print("Will retry...", flush=True)
time.sleep(10)
class Consumer(BaseProcessor): class Consumer(BaseProcessor):