ries-lab / DECODE_Cloud_WorkerAPI

0 stars 0 forks source link

DECODE_Cloud_WorkerAPI

Code for the worker-facing API of DECODE OpenCloud.

The worker-facing API handles the communication with the workers. The authenticated workers can:

Behind the scenes, the API communicates with the user-facing API of DECODE OpenCloud. It forwards the status updates to the user-facing API, and gets new jobs from it.

Development guide

Prepare the development environment

We use poetry for dependency tracking. See online guides on how to use it, but this setup should work:

Install the pre-commit hooks: pre-commit install. These currently include ruff and mypy.

Run locally

Define the environment variables

Copy the .env.example file to a .env file at the root of the directory and define its fields appropriately:

Start the user-facing API

poetry run serve

View the API documentation

You can find it at <API_URL>/docs (if running locally, <API_URL>=localhost:81).

Docker

Alternatively, you can build a Docker image. For this, run poetry run docker-build: This will create a Docker image named workerfacing-api:<branch_name>.
To run the Docker container, use poetry run docker-serve.
To stop and delete all containers for this package, use poetry run docker-stop. If you want to additionally remove all images for this package and prune dangling images, run poetry run docker-cleanup.

Tests

Run them with poetry run pytest. Note that tests marked with aws are skipped by default, to avoid the need for an AWS setup.