After digging further through Ray's documentation, orthogonal to J_H's answer, this is the style Ray seems to prefer and is the cleanest in my opinion:
import ray
import numpy as np
ray.init()
@ray.remote
def test_function(x):
try:
if np.random.rand() < 0.5:
raise Exception
return [x, x*x, "The day is blue"]
except Exception:
return None
futures = [test_function.remote(i) for i in range(10000)]
print(ray.get(futures))
And then the None
entries can be dropped either in the list itself, or when importing into Pandas with .dropna()
.
Hopefully this helps someone in the future :)