Jai P
03/02/2023, 4:01 PMRuntimeError: <asyncio.locks.Event object at 0x11447f760 [unset]> is bound to a different event loop
when attempting to run subflows in parallel, but only when running against Prefect Cloud. details in threadJai P
03/02/2023, 4:01 PMimport random
from prefect import flow, task
from prefect.utilities.asyncutils import run_sync_in_worker_thread
@task
def my_random():
return random.random()
@flow
def my_subflow():
result = my_random()
return result
@flow
async def my_test_flow():
subflows = [run_sync_in_worker_thread(deepcopy(my_subflow)) for _ in range(10)]
results = await asyncio.gather(*subflows)
print(results)
if __name__ == "__main__":
asyncio.run(my_test_flow())
is the code, when i run against my local prefect everything is fine, but when i prefect cloud login
then it falls apartJai P
03/02/2023, 4:04 PMJai P
03/02/2023, 4:42 PMChristopher Boyd
03/03/2023, 1:53 PMJai P
03/03/2023, 7:00 PMChristopher Boyd
03/03/2023, 7:02 PMChristopher Boyd
03/03/2023, 7:02 PMJai P
03/03/2023, 7:03 PMJai P
03/03/2023, 7:04 PM