Skip to main content

All Questions

1 vote
0 answers
489 views

How can I run/start an async periodic task in the background in FastAPI [duplicate]

Assuming to have a list of Callable async tasks and I wish to run them in a background with a periodic timing. How can I design this with FastAPI? In my toy example I tried the BackgroundTasks but as ...
Luca's user avatar
  • 135
0 votes
0 answers
27 views

Execution Python coroutine as background task in new Thread [duplicate]

I've code which looks like this way: class Service: async def publish(file_obj): """Sending file_obj to s3""" def render_pdf(data: dict): &...
Leo's user avatar
  • 33
2 votes
0 answers
216 views

function running in a different event loop [duplicate]

I am using fastapi with beanie as ODM and asyncio, 2 functions taking a lot of time so I decided to run these function in parallel, I tried thread but it's giving a function running in a different ...
lEgeL çOdēR's user avatar
0 votes
2 answers
965 views

FastAPI coroutine within thread or thread within coroutine [duplicate]

I am writing a FastAPI application and, for a given path operation, I need call two functions: one is an IO operation that doesn't support async (let's call it function A) and the other one is an IO ...
srcolinas's user avatar
  • 515
19 votes
3 answers
27k views

How to send server-side events from python (fastapi) upon calls to a function that updates the backend state

I have the following problem: given a backend running fastapi, that has a streaming endpoint, which is used to update the frontend, I want to send these updates every time the function that updates ...
Vini's user avatar
  • 343