uvicorn

Why can't docker compose find uvicorn module

Why can't docker compose find uvicorn module Question: I am new to docker and was trying to dockerize my fastapi application. I built a Dockerfile shown below # syntax=docker/dockerfile:1 FROM python:3.8-slim-buster WORKDIR /app COPY requirements.txt requirements.txt RUN apt-get update RUN apt-get -y install libpq-dev gcc RUN apt-get -y install libnss3-tools RUN apt-get -y install curl …

Total answers: 2

FastApi with gunicorn/uvicorn stops responding

FastApi with gunicorn/uvicorn stops responding Question: I’m currently using FastApi with Gunicorn/Uvicorn as my server engine. I’m using the following config for Gunicorn: TIMEOUT 0 GRACEFUL_TIMEOUT 120 KEEP_ALIVE 5 WORKERS 10 Uvicorn has all default settings, and is started in docker container casually: CMD ["uvicorn", "app.main:app", "–host", "0.0.0.0", "–port", "8000"] Everything is packed in docker …

Total answers: 1

Asyncio running multiple asynconrous functions at once with uvicorn and fastapi

Asyncio running multiple asynconrous functions at once with uvicorn and fastapi Question: I’m having some problems with running my own async functions with uvicorn (fastapi) My goal is to be able to run the queue manager function, as well as the uvicorn webapp. However, it seems that my start function blocks the uvicorn.run code from …

Total answers: 2

FastAPI with uvicorn won't allow thread usage to exceed ~65%

FastAPI with uvicorn won't allow thread usage to exceed ~65% Question: I have written a machine learning inference library which has python bindings. Under normal operation, this library will use 8 threads for inference, and will max out all 8 threads 100%. This is the desired behavior as the model is very heavy and I …

Total answers: 1

How to run FastAPI application inside Jupyter?

How to run FastAPI application inside Jupyter? Question: I am learning FastAPI and I have this example. from fastapi import FastAPI app = FastAPI() @app.get("/") async def root(): return {"message": "Hello World"} I saved the script as main.ipynb The tutorial says to run this line of code in the command line: uvicorn main:app –reload I …

Total answers: 1

Unclosed socket due to spawn child processes using multiprocessing

Unclosed socket due to spawn child processes using multiprocessing Question: I don’t really understand what’s going on with http requests. When I started child processes and uvicorn timeout_keep_alive timed out, I tried hitting "stop" in the browser and got infinite loading and no HTTP connection log. But if I try to click other buttons or …

Total answers: 2

How to run Uvicorn FastAPI server as a module from another Python file?

How to run Uvicorn FastAPI server as a module from another Python file? Question: I want to run FastAPI server using Uvicorn from A different Python file. uvicornmodule/main.py import uvicorn import webbrowser from fastapi import FastAPI from fastapi.responses import FileResponse from fastapi.staticfiles import StaticFiles app = FastAPI() import os script_dir = os.path.dirname(__file__) st_abs_file_path = os.path.join(script_dir, …

Total answers: 1

FastAPI performs worse than Flask

FastAPI performs worse than Flask Question: Previously I used Flask in combination with Gunicorn to develop and deploy APIs In Redhat OpenShift. Multiple sources claim that FastAPI is faster, so I thought I will make two simple API’s in both Flask and in FastAPI to be able to compare them. The code written in Flask …

Total answers: 2

fastapi logging error and swagger is not working

fastapi logging error and swagger is not working Question: I’m making a rest API using fastapi. I just wonder why I get below messages whenever I execute my server. INFO: Started server process [97154] INFO: Waiting for application startup. INFO: Application startup complete. — Logging error — Traceback (most recent call last): File "/usr/lib/python3.10/logging/__init__.py", line …

Total answers: 1