Theis Ferré Hjortkjær
09/18/2023, 7:09 AMfrom prefect import flow, task
from prefect_ray.task_runners import RayTaskRunner
from prefect_ray.context import remote_options
@task
def process(x):
return x + 1
@flow(task_runner=RayTaskRunner("ray://<my-ray-service>:10001"))
def my_flow():
# equivalent to setting @ray.remote(num_cpus=4)
with remote_options(num_cpus=4):
process.submit(42)
It fails with a runtime error:
RuntimeError: There is no current event loop in thread 'ray_client_server_1'.
If i do not specify resources for my task, everything works as intended.
I have submitted an issue, but it has not been picked up yet, so i thought maybe i could get some help here 🙂
https://github.com/PrefectHQ/prefect/issues/10542