Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/actions/start-services/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Start Services
description: Start Docker Compose services

inputs:
profiles:
description: "Comma-separated list of profiles to start (e.g. 'all' or 'rest-api,minio')"
required: false
default: "all"
services:
description: "Comma-separated list of specific services to start (e.g. 'database,elasticsearch')"
required: false
default: ""

runs:
using: composite
steps:
- name: Set permission for mount paths
shell: bash
run: |
chmod -R 777 ./data/php
chmod -R 777 ./logs
- name: Start services
shell: bash
run: |
PROFILE_FLAGS=""
for profile in $(echo "${{ inputs.profiles }}" | tr ',' ' '); do
PROFILE_FLAGS="$PROFILE_FLAGS --profile $profile"
done
SERVICES=$(echo "${{ inputs.services }}" | tr ',' ' ')
docker compose $PROFILE_FLAGS up -d --build --wait $SERVICES

- name: Show service status
if: always()
shell: bash
run: docker compose ps
90 changes: 90 additions & 0 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Integration Test

on:
pull_request:
paths:
- "docker-compose.yaml"
- "scripts/**"
- "config/**"

jobs:
dataset-processing:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Start services
uses: ./.github/actions/start-services
with:
profiles: "rest-api,evaluation-engine"

- name: Create dataset
id: dataset
run: |
DATASET_ID=$(bash scripts/upload_dataset.sh)
echo "Dataset ID: $DATASET_ID"
echo "id=$DATASET_ID" >> "$GITHUB_OUTPUT"

- name: Dataset Processing
run: bash scripts/wait_for_dataset.sh "${{ steps.dataset.outputs.id }}" 180

- name: Show logs on failure
if: failure()
run: docker compose logs --tail=50

task-processing:
Comment thread
josvandervelde marked this conversation as resolved.
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Start services
uses: ./.github/actions/start-services
with:
profiles: "rest-api,evaluation-engine"

- name: Create task
id: task
run: |
TASK_ID=$(bash scripts/create_task.sh 129 1)
echo "Task ID: $TASK_ID"
echo "id=$TASK_ID" >> "$GITHUB_OUTPUT"

- name: Task Processing
run: bash scripts/wait_for_task.sh "${{ steps.task.outputs.id }}" 180

- name: Show logs on failure
if: failure()
run: docker compose logs --tail=50

run-processing:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Start services
uses: ./.github/actions/start-services
with:
profiles: "rest-api,evaluation-engine"

- name: Upload run
id: run
run: |
RUN_ID=$(bash scripts/upload_run.sh)
echo "Run ID: $RUN_ID"
echo "id=$RUN_ID" >> "$GITHUB_OUTPUT"

- name: Run Processing
Comment thread
josvandervelde marked this conversation as resolved.
run: bash scripts/wait_for_run.sh "${{ steps.run.outputs.id }}" 180

- name: Show logs on failure
if: failure()
run: docker compose logs --tail=50
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ be slightly altered to use them in the test setup: change https to http.

## Development

### Services
When working on the `services` repository itself, the `scripts` directory provides a small number of integration tests to catch the most glaring issues. They are currently limited to REST API and evaluation engine functionality and also run automatically in CI.

For example, after starting services, to test dataset upload run:
```bash
./scripts/upload_dataset.sh
```
If successful, this will also print the dataset id assigned to the new dataset.
To test if dataset processing works, we can then run:
```bash
./scripts/wait_for_dataset.sh DATASET_ID
```
where `DATASET_ID` is replaced by the identifier printed in the previous step.

### PHP, Parquet and Croissant converter
If you want to do local development on containers that are part of the docker-compose, you want those containers to change based on your code. You should have the relevant code somewhere on your system. You will need to tell the docker-compose where to find it. You can do so by setting environment variables.

Expand Down
33 changes: 33 additions & 0 deletions scripts/create_task.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Creates a task for a given dataset and estimation procedure, prints the task ID to stdout.
# Usage: create_task.sh DATASET_ID ESTIMATION_PROCEDURE_ID [TARGET_FEATURE]
set -euo pipefail

DATASET_ID="${1:?Usage: create_task.sh DATASET_ID ESTIMATION_PROCEDURE_ID [TARGET_FEATURE]}"
ESTIMATION_PROCEDURE_ID="${2:?Usage: create_task.sh DATASET_ID ESTIMATION_PROCEDURE_ID [TARGET_FEATURE]}"
TARGET_FEATURE="${3:-class}"

TMPFILE=$(mktemp /tmp/task_desc.XXXXXX.xml)
trap 'rm -f "$TMPFILE"' EXIT

cat > "$TMPFILE" << EOF
<oml:task_inputs xmlns:oml="http://openml.org/openml">
<oml:task_type_id>1</oml:task_type_id>
<oml:input name="source_data">${DATASET_ID}</oml:input>
<oml:input name="estimation_procedure">${ESTIMATION_PROCEDURE_ID}</oml:input>
<oml:input name="target_feature">${TARGET_FEATURE}</oml:input>
</oml:task_inputs>
EOF

RESPONSE=$(curl -sS -X POST "http://localhost:8000/api/v1/xml/task?api_key=normaluser" \
-F "description=@${TMPFILE};type=text/xml")

TASK_ID=$(echo "$RESPONSE" | sed -n 's/.*<oml:id>\([0-9]*\)<\/oml:id>.*/\1/p')

if [ -z "$TASK_ID" ]; then
echo "Server response:" >&2
echo "$RESPONSE" >&2
exit 1
fi

echo "$TASK_ID"
Loading
Loading