See https://docs.ray.io/en/latest/serve/api/doc/ray.serve.batch.html for a straightforward implementation