Skip to content

Commit

Permalink
Fix API call on online test action
Browse files Browse the repository at this point in the history
  • Loading branch information
luandro committed Mar 26, 2024
1 parent 7f9cb0f commit 7bd55f7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/online-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ jobs:
- name: Execute RAG API query
run: |
commit_hash=$(git rev-parse --short HEAD)
echo $commit_hash
echo "Commit Hash: $commit_hash"
success=false
for i in {1..5}; do
echo "Attempt $i:"
response=$(docker exec kakawa_rag_api python -c "import requests; response = requests.get('https://kakawa_rag_api:8000/rag?query=How%20to%20install%20Mapeo&user_id=github_action&session_id=$commit_hash', headers={'accept': 'application/json'}); print(response.status_code)")
if [ "$response" -eq 200 ]; then
response=$(docker exec kakawa_rag_api python -c "import requests; try: response = requests.get('https://kakawa_rag_api:8000/rag?query=How%20to%20install%20Mapeo&user_id=github_action&session_id=$commit_hash', headers={'accept': 'application/json'}); print(response.status_code) except requests.exceptions.RequestException as e: print(e)")
if echo "$response" | grep -q "200"; then
echo "RAG API endpoint is up and running."
success=true
break
elif echo "$response" | grep -q "ConnectionError"; then
echo "Connection error occurred. Retrying in 20 seconds..."
sleep 20
else
echo "Attempt $i failed with status code $response. Retrying in 20 seconds..."
sleep 20
Expand Down

0 comments on commit 7bd55f7

Please sign in to comment.