-
Notifications
You must be signed in to change notification settings - Fork 551
test: Add HF Space Dockerfile using pre-built leaderboard image #3838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| name: Test HF Space Dockerfile | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| paths: | ||
| - 'Dockerfile.hf-space' | ||
| - '.github/workflows/hf_space_docker.yml' | ||
| pull_request: | ||
| branches: [ main ] | ||
| paths: | ||
| - 'Dockerfile.hf-space' | ||
| - '.github/workflows/hf_space_docker.yml' | ||
|
Comment on lines
+5
to
+13
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this action won't be triggered
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you check the right sections? https://github.com/embeddings-benchmark/mteb/actions/runs/20725664296/job/59500466946?pr=3838
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked this. This will be triggered only on changed in dockerfile for spaces, but I'm not sure if it will be enough to test then
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to move these checks to
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, that's what the paths section of the workflow file shows. I'm not sure there's new info here.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeping these tests separate makes more sense. |
||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test-hf-space-dockerfile: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Free disk space | ||
| run: | | ||
| sudo rm -rf \ | ||
| "$AGENT_TOOLSDIRECTORY" \ | ||
| /opt/ghc \ | ||
| /opt/google/chrome \ | ||
| /opt/microsoft/msedge \ | ||
| /opt/microsoft/powershell \ | ||
| /opt/pipx \ | ||
| /usr/lib/mono \ | ||
| /usr/local/julia* \ | ||
| /usr/local/lib/android \ | ||
| /usr/local/lib/node_modules \ | ||
| /usr/local/share/chromium \ | ||
| /usr/local/share/powershell \ | ||
| /usr/share/dotnet \ | ||
| /usr/share/swift || true | ||
| docker system prune -af || true | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build HF Space Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile.hf-space | ||
| push: false | ||
| tags: mteb-hf-space:test | ||
| load: true | ||
|
|
||
| - name: Test container can start and run | ||
| timeout-minutes: 6 | ||
| run: | | ||
| # Start the container in background | ||
| docker run -d --name mteb-hf-test -p 7860:7860 mteb-hf-space:test | ||
|
|
||
| # Monitor container with smart exit conditions | ||
| echo "Starting HF Space leaderboard container..." | ||
| START_TIME=$(date +%s) | ||
| STARTUP_DETECTED=false | ||
| INIT_COMPLETE_DETECTED=false | ||
|
|
||
| while true; do | ||
| CURRENT_TIME=$(date +%s) | ||
| ELAPSED=$((CURRENT_TIME - START_TIME)) | ||
|
|
||
| # Maximum timeout: 5.5 minutes | ||
| if [ $ELAPSED -gt 330 ]; then | ||
| echo "Timeout reached after ${ELAPSED}s - container failed to complete initialization" | ||
| docker logs --tail 20 mteb-hf-test | ||
| docker stop mteb-hf-test | ||
| docker rm mteb-hf-test | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check if container is still running | ||
| if ! docker ps | grep -q mteb-hf-test; then | ||
| EXIT_CODE=$(docker inspect mteb-hf-test --format='{{.State.ExitCode}}') | ||
| echo "Container exited with code: $EXIT_CODE after ${ELAPSED}s" | ||
|
|
||
| LOGS=$(docker logs mteb-hf-test 2>&1) | ||
| if echo "$LOGS" | grep -q "=== Leaderboard app initialization complete" || \ | ||
| echo "$LOGS" | grep -q "Running on.*http"; then | ||
| echo "Container completed significant startup progress successfully" | ||
| docker rm mteb-hf-test | ||
| exit 0 | ||
| else | ||
| echo "Container failed before completing startup initialization" | ||
| echo "Last logs:" | ||
| echo "$LOGS" | tail -10 | ||
| docker rm mteb-hf-test | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| LOGS=$(docker logs mteb-hf-test 2>&1) | ||
|
|
||
| if [ "$STARTUP_DETECTED" = "false" ] && echo "$LOGS" | grep -q "Starting leaderboard app in process"; then | ||
| echo "Detected leaderboard app startup" | ||
| STARTUP_DETECTED=true | ||
| fi | ||
|
|
||
| if [ "$INIT_COMPLETE_DETECTED" = "false" ] && echo "$LOGS" | grep -q "=== Leaderboard app initialization complete"; then | ||
| echo "Detected full app initialization complete!" | ||
| INIT_COMPLETE_DETECTED=true | ||
| sleep 3 | ||
| if curl -s --max-time 5 http://localhost:7860/ > /dev/null; then | ||
| echo "Server is responding - container fully operational!" | ||
| docker stop mteb-hf-test | ||
| docker rm mteb-hf-test | ||
| exit 0 | ||
| fi | ||
| fi | ||
|
|
||
| if echo "$LOGS" | grep -q "Running on.*http"; then | ||
| echo "Detected Gradio server ready - container fully operational!" | ||
| docker stop mteb-hf-test | ||
| docker rm mteb-hf-test | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ $((ELAPSED % 30)) -eq 0 ] && [ $ELAPSED -gt 0 ]; then | ||
| echo "Container still running after ${ELAPSED}s... (startup: $STARTUP_DETECTED, init_complete: $INIT_COMPLETE_DETECTED)" | ||
| echo "$LOGS" | grep -E "(Step [0-9]/7|Starting leaderboard|initialization complete|Running on)" | tail -2 | ||
| fi | ||
|
|
||
| sleep 5 | ||
| done | ||
isaac-chung marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| FROM ghcr.io/embeddings-benchmark/mteb/leaderboard:latest | ||
|
|
||
| ENV GRADIO_SERVER_NAME="0.0.0.0" | ||
| EXPOSE 7860 | ||
isaac-chung marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| CMD ["make", "run-leaderboard"] | ||
Uh oh!
There was an error while loading. Please reload this page.