Skip to content

Split up Python API in light and full service - #19

Open
PGijsbers wants to merge 3 commits into
mainfrom
update-python-api-service
Open

PGijsbers wants to merge 3 commits into
mainfrom
update-python-api-service

Conversation

@PGijsbers

Copy link
Copy Markdown
Contributor

This patch introduces a way to spin up a 'light weight' Python REST API that supports database interactions and nothing else (e.g., no downloading of files). This should cover most use cases for testing the API and is faster to start (and less resource intensive).

Also fixes #17.

@PGijsbers
PGijsbers requested review from omosola and removed request for omosola September 16, 2026 08:26
Comment thread docker-compose.yaml
Comment on lines -102 to -103
nginx:
condition: service_started # used for routing to MinIO and PHP REST API

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure whether to keep the nginx around for the 'light' version. For now, I figured to keep it truly minimal. It's easy enough to specify docker compose up python-api-light nginx if you do want the routing to be available.

@PGijsbers
PGijsbers requested review from omosola and removed request for omosola September 16, 2026 08:30
Comment thread README.md
Comment on lines +62 to +70
The Python REST API is also available in a 'light' mode that allows for database interactions
but does not allow for file uploads/downloads. It has to be started directly (as opposed to
through a profile):
```bash
docker compose up python-rest-api-light -d
docker compose down
```
While it is up, the API is available under `http://localhost:8082`, e.g., `http://localhost:8082/datasets/1`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot simply add a profile to the service as it is defined right now, since the python-rest-api service will also get that profile (due to extends) but the other dependencies of the python-rest-api (e.g., php-api) will not have that profile (and should not have the profile, since we don't want to start them).

I think this is perfectly fine, we are probably defining too many profiles in the first place. But if we do want to keep using profiles even for single services, then we could work around that with yaml anchoring, e.g.

 python-api-light:
      profiles: ["rest-api-light"]
  -   image: openml/rest-api:0.0.1-alpha
  +   image: &python-api-image openml/rest-api:0.0.1-alpha    # define anchor

and then

   python-api:
      profiles: ["all", "rest-api"]            # only its own profiles, not merged
  -   extends: python-api-light
  +   image: *python-api-image                 # copied from python-api-light

@omosola omosola left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the review to @josvandervelde.

Thanks for putting in this fix @PGijsbers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker compose for rest-api profile fails

2 participants