A demonstration of how to create a Python API that also calls Julia code.
- Install docker
- Run
docker-compose up
from this repo's top directory - Create a job with
curl -X POST "localhost:8000/job"
, which will return{"job_uuid": "57ca5074-05cc-4a60-830a-9af9a1b8641e"}
- Copy the
job_uuid
and pass it to the result endpoint withcurl -X GET "localhost:8000/result?job_uuid=57ca5074-05cc-4a60-830a-9af9a1b8641e"
- The Python Django package is used to create the external API (exposes port 8000).
- Within Django we use Postgres to store the data.
- Within Django we use Celery to manage asynchronous tasks, specifically a python task called
runjob
is kicked off in thejob
view - (Redis is used as the task queue for Celery)
- The
runjob
task calls an internal Julia API to further process the job. - Results are updated in the Postgres database, which the user can receive via the
result
endpoint.