Please consider the following toy application:
import ray
class DowningToolsError(Exception):
pass
@ray.remote
class Supervisor:
def __init__(self):
print('Supervisor working')
self._worker1 = Worker1.remote()
try:
self._worker2 = Worker2.remote()
except DowningToolsError:
print(f"Worker did not like that idea! Let's try another plan!")
@ray.remote
class Worker1:
def __init__(self):
print('Worker1 working')
@ray.remote
class Worker2:
def __init__(self):
raise DowningToolsError('You must be kidding me!')
if __name__ == '__main__':
Supervisor = Supervisor.remote()
while True:
pass
What do I have to do instead of:
except DowningToolsError:
print(f"Worker did not like that idea! Let's try another plan!")
to make Supervisor gracefully handle Worker2’s failure?
I have tried the following:
except ray.exceptions.RayActorError:
print(f"Worker2 is not available. Let's try another plan!")
but that did not have the desired effect.
Any suggestions would be much appreciated!
I