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
2 changes: 2 additions & 0 deletions medcat-service/docker/docker-compose.example.deid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ services:
- APP_MEDCAT_MODEL_PACK=/cat/models/examples/example-deid-model-pack.zip
- DEID_MODE=True
- DEID_REDACT=True
- APP_ENABLE_METRICS=True
- APP_ENABLE_DEMO_UI=True
ports:
- "5555:5000"
2 changes: 2 additions & 0 deletions medcat-service/docker/docker-compose.example.v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ services:
environment:
# Uses a preloaded model pack example inside the image
- APP_MEDCAT_MODEL_PACK=/cat/models/examples/example-medcat-v1-model-pack.zip
- APP_ENABLE_METRICS=True
- APP_ENABLE_DEMO_UI=True
ports:
- "5555:5000"
4 changes: 3 additions & 1 deletion medcat-service/docker/docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ services:
restart: unless-stopped
environment:
# Uses a preloaded model pack example inside the image
- APP_MEDCAT_MODEL_PACK=/cat/models/examples/example-medcat-v2-model-pack.zip
- APP_MEDCAT_MODEL_PACK=/cat/models/examples/example-medcat-v2-model-pack.zip
- APP_ENABLE_METRICS=True
- APP_ENABLE_DEMO_UI=True
ports:
- "5555:5000"
7 changes: 3 additions & 4 deletions medcat-service/medcat_service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
app.include_router(process.router)


if settings.enable_demo_ui:
mount_gradio_app(app, path=settings.demo_ui_path)


def configure_observability(settings: Settings, app: FastAPI):
if settings.observability.enable_metrics:
from prometheus_fastapi_instrumentator import Instrumentator
Expand All @@ -52,6 +48,9 @@ def configure_observability(settings: Settings, app: FastAPI):

configure_observability(settings, app)

if settings.enable_demo_ui:
mount_gradio_app(app, path=settings.demo_ui_path)


@app.exception_handler(HealthCheckFailedException)
async def healthcheck_failed_exception_handler(request: Request, exc: HealthCheckFailedException):
Expand Down
29 changes: 25 additions & 4 deletions medcat-service/scripts/integration_test_functions.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
smoketest_medcat_service() {
local localhost_name="$1"
local docker_compose_file="$2"
local port="${3:-5555}"

local apis=(
"/api/info"
"/api/health/live"
"/api/health/ready"
"/metrics"
"/docs"
)

for api in "${apis[@]}"; do
test_medcat_service_api "$localhost_name" "$docker_compose_file" "$api" "$port"
done
}


test_medcat_service_api() {
local localhost_name="$1"
local docker_compose_file="$2"
local port=${3:-5555}
local resource="${3:-/api/info}"
local port="${4:-5555}"
if [ -z "$localhost_name" ] || [ -z "$docker_compose_file" ]; then
echo "Invalid arguments. Usage: health_check <localhost_name> <docker_compose_file>" >&2
echo "Invalid arguments. Usage: smoketest_medcat_service <localhost_name> <docker_compose_file> [resource] [port]" >&2
echo " resource: e.g. /api/info (default: /api/info)" >&2
return 1
fi

API="http://${localhost_name}:${port}/api/info"
API="http://${localhost_name}:${port}${resource}"

MAX_RETRIES=12
RETRY_DELAY=5
Expand All @@ -23,7 +44,7 @@ smoketest_medcat_service() {
break
else
echo "Attempt $((COUNT+1))/$MAX_RETRIES: Not ready (HTTP $IS_READY)."
docker compose -f ${DOCKER_COMPOSE_FILE} logs
docker compose -f "$docker_compose_file" logs
COUNT=$((COUNT+1))
fi
done
Expand Down
Loading