I want to write a function in Python 3.6 with multiprocessing, where workers execute a function
def f(x):
.
.
in such a way that every time an error is raised in the child process, that child process should restart.
This is my code:
for worker in workers:
def nested(worker):
try:
`proc=multiprocessing.Process(target=f,\
args=(args[worker],))
proc.start()
except:
nested(worker)
nested(worker)
The problem is that this structure does not catch the error in the child process, so it does not work as intended. Unfortunately, the solutions in Python Multiprocessing: Handling Child Errors in Parent are very specific to the problem in that thread and cannot really be applied here.
Does anyone have an idea how to fix this?