Adds daily check
This commit is contained in:
parent
ebdff5c136
commit
1070c64b35
|
|
@ -0,0 +1,134 @@
|
|||
name: Daily Docker Model Runner Health Check
|
||||
|
||||
on:
|
||||
push: # temporary, to test the wf
|
||||
schedule:
|
||||
# Run daily at 6 AM UTC
|
||||
- cron: '0 6 * * *'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
test_model:
|
||||
description: 'Model to test with (default: ai/smollm2:360M-Q4_K_M)'
|
||||
required: false
|
||||
type: string
|
||||
default: 'ai/smollm2:360M-Q4_K_M'
|
||||
|
||||
jobs:
|
||||
dmr-health-check:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Set up Docker
|
||||
uses: docker/setup-docker-action@v4
|
||||
|
||||
- name: Install docker-model-plugin
|
||||
run: |
|
||||
echo "Installing docker-model-plugin..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y docker-model-plugin
|
||||
|
||||
echo "Installation completed successfully"
|
||||
|
||||
- name: Test docker model version
|
||||
run: |
|
||||
echo "Testing docker model version command..."
|
||||
sudo docker model version
|
||||
|
||||
# Verify the command returns successfully
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ docker model version command works correctly"
|
||||
else
|
||||
echo "❌ docker model version command failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Test model pull and run
|
||||
run: |
|
||||
MODEL="${{ github.event.inputs.test_model }}"
|
||||
echo "Testing with model: $MODEL"
|
||||
|
||||
# Test model pull
|
||||
echo "Pulling model..."
|
||||
sudo docker model pull "$MODEL"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Model pull successful"
|
||||
else
|
||||
echo "❌ Model pull failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test basic model run (with timeout to avoid hanging)
|
||||
echo "Testing docker model run..."
|
||||
timeout 60s sudo docker model run "$MODEL" "Give me a fact about whales." || {
|
||||
exit_code=$?
|
||||
if [ $exit_code -eq 124 ]; then
|
||||
echo "✅ Model run test completed (timed out as expected for non-interactive test)"
|
||||
else
|
||||
echo "❌ Model run failed with exit code: $exit_code"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
- name: Test API endpoint
|
||||
run: |
|
||||
MODEL="${{ github.event.inputs.test_model }}"
|
||||
echo "Testing API endpoint with model: $MODEL"
|
||||
|
||||
# Test API call with curl
|
||||
echo "Testing API call..."
|
||||
RESPONSE=$(curl -s http://localhost:12434/engines/llama.cpp/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "$MODEL",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Say hello"
|
||||
}
|
||||
],
|
||||
"top_k": 1,
|
||||
"temperature": 0
|
||||
}')
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ API call successful"
|
||||
echo "Response received: $RESPONSE"
|
||||
|
||||
# Check if response contains "hello" (case-insensitive)
|
||||
if echo "$RESPONSE" | grep -qi "hello"; then
|
||||
echo "✅ Response contains 'hello' (case-insensitive)"
|
||||
else
|
||||
echo "❌ Response does not contain 'hello'"
|
||||
echo "Full response: $RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ API call failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Test model cleanup
|
||||
run: |
|
||||
MODEL="${{ github.event.inputs.test_model }}"
|
||||
|
||||
echo "Cleaning up test model..."
|
||||
sudo docker model rm "$MODEL" || echo "Model removal failed or model not found"
|
||||
|
||||
# Verify model was removed
|
||||
echo "Verifying model cleanup..."
|
||||
sudo docker model ls
|
||||
|
||||
echo "✅ Model cleanup completed"
|
||||
|
||||
- name: Report success
|
||||
if: success()
|
||||
run: |
|
||||
echo "🎉 Docker Model Runner daily health check completed successfully!"
|
||||
echo "All tests passed:"
|
||||
echo " ✅ docker-model-plugin installation successful"
|
||||
echo " ✅ docker model version command working"
|
||||
echo " ✅ Model pull and run operations successful"
|
||||
echo " ✅ API endpoint operations successful"
|
||||
echo " ✅ Cleanup operations successful"
|
||||
Loading…
Reference in New Issue