Edmund Tian
12/19/2022, 9:00 PMRuntimeError: The task runner is already started!
Context:
I have an application hosted on GCP Cloud Run that allows multiple requests per container. Whenever my application receives an API request with a user_id
param, it triggers a flow run to update data for that user.
When I trigger the first Flow Run via an API request, everything works fine. But if I call the API again while the first Run is ongoing, my second API request with throw the above RuntimeError.
More context:
My application is written in Flask and served with Gunicorn. It’s deployed on GCP Cloud Run. Here’s the gunicorn config in my dockerfile
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 pelm_utility_service:app
Edmund Tian
12/19/2022, 9:02 PMRyan Peden
12/19/2022, 9:25 PMflow_run = my_flow_function.with_options(task_runner=ConcurrentTaskRunner())
flow_run()
Edmund Tian
12/19/2022, 9:27 PMRyan Peden
12/19/2022, 9:36 PM