/MCalculateTest

Primary LanguagePythonMIT LicenseMIT

Asynchronous Calculate Tasks with FastAPI and Celery

Test of how to handle background processes with FastAPI, Celery, and Docker.

How to run?

Set up the containers:

$ docker-compose up -d --build

Open your browser to http://localhost/docs to view docs

swagger

Trigger a new task:

$ curl http://localhost/calculate -H "Content-Type: application/json" --data '{"x": 1, "y": 1, "operation": "+"}'

Check the status:

$ curl http://localhost/tasks/<TASK_ID>

Get list of all tasks:

$ curl http://localhost/tasks/

Pre-commit

You need to check the code before committing. Install pre-commit and add as a hook:

$ pip install pre-commit
$ pre-commit install

Run manually:

$ pre-commit run --all-files

pre-commit

Sentry

sentry

configure sentry dsn in .env file

SENTRY_DSN=https://***.ingest.sentry.io/***
SENTRY_ENV=env