I have a fastapi service deployed on AWS, the API sends request to OpenAI API to generate text.
This API had been running fine for 2-3 days but now it keeps restarting on it’s own after every 10 minutes. There are no errors or any helpful information in the AWS logs.
I also set request_timeout to 30 seconds in case this was happening because OpenAI API took too long to respond.
Any info about this is appreciated.
edit:
start.sh file contains this line: python3 main.py
and main.py is as follows:
import uvicorn
if __name__ ="__main__":
uvicorn.run("app.main:app, host="0.0.0.0", port=9026, reload=True)
2
Answers
you need to try
uvicorn app.main:app --reload --host 0.0.0.0 --port 9026
in bash script to run, It is just another way to run.
Please check health check in Task Definition
Its mentioned here:
uvicorn shutting down after 1-2 minutes on AWS Fargate