-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deferring a job from FastAPI route: The future belongs to a different loop than the one specified as the loop argument #852
Comments
You're in an async project, use EDIT Damn sorry, read too fast, missed the sentence between the 2 blocks. I'll re-read and re-reply |
I'm seeing you're using part of the sync api though, by calling |
Hey @ewjoachim, thanks for the reply, will do! |
So I thought a bit about the problem. My goal would be to use the sync API only. All my logic is sync. So I also modified the FastAPI route to be a sync
The thing is that FastAPI processes the request to a sync |
For the sake of giving the full picture, I tried the However, this does not suite my needs as I want to define my FastAPI endpoint as a sync |
I believe your issue will likely be solved by #753 but I can't make promises on when it will be merged. Mixing sync and async really is a pain :( Sorry. |
Hi,
I am trying to defer a job from a FastAPI route, and ends up with asyncio issues. FastAPI also uses asyncio at its core.
My code looks roughly like this:
FastAPI route:
My FastAPI worker is Uvicorn.
Procrastinate task:
I end up with the following Exception:
I tried using the sync version
defer
withoutawait
, but no chance, I also end up with another asyncio exception:Please note that I do see the job created in the
procrastinate_jobs
table.Thanks for your help!
The text was updated successfully, but these errors were encountered: