Skip to content

Commit

Permalink
debug dind
Browse files Browse the repository at this point in the history
  • Loading branch information
baptistecolle committed Jan 6, 2025
1 parent 38d2903 commit 151133e
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions .github/workflows/debug-dind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,59 +26,59 @@ jobs:
# but it's not in a single step inside a python script so it can be run locally
# this scripts work on the local machine, not in the github actions environment
# i left commented out for now, as "Create test server Dockerfile", "Create minimal test server", "Build and run test container" maybe be easier to debug in a ci environment
- name: Run test
run: |
python debug-dind-locally/test.py
# - name: Create test server Dockerfile
# - name: Run test
# run: |
# cat << EOF > Dockerfile
# FROM us-central1-docker.pkg.dev/tpu-pytorch-releases/docker/xla:r2.4.0_3.10_tpuvm
# python debug-dind-locally/test.py

- name: Create test server Dockerfile
run: |
cat << EOF > Dockerfile
FROM us-central1-docker.pkg.dev/tpu-pytorch-releases/docker/xla:r2.4.0_3.10_tpuvm
# WORKDIR /app
# RUN pip install fastapi uvicorn
WORKDIR /app
RUN pip install fastapi uvicorn
# COPY server.py .
COPY server.py .
# EXPOSE 8080
# CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8080"]
# EOF
EXPOSE 8080
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8080"]
EOF
# - name: Create minimal test server
# run: |
# cat << EOF > server.py
# from fastapi import FastAPI
# from pydantic import BaseModel
- name: Create minimal test server
run: |
cat << EOF > server.py
from fastapi import FastAPI
from pydantic import BaseModel
# app = FastAPI()
app = FastAPI()
# class GenerateRequest(BaseModel):
# inputs: str
class GenerateRequest(BaseModel):
inputs: str
# @app.post("/generate")
# async def generate(request: GenerateRequest):
# return {
# "generated_text": "Hello World!",
# "request_received": request.dict()
# }
# EOF
@app.post("/generate")
async def generate(request: GenerateRequest):
return {
"generated_text": "Hello World!",
"request_received": request.dict()
}
EOF
# - name: Build and run test container
# run: |
# docker build -t test-tgi-server .
# docker run -d -p 8080:8080 --name test-server test-tgi-server
- name: Build and run test container
run: |
docker build -t test-tgi-server .
docker run -d -p 8080:8080 --name test-server test-tgi-server
# sleep 5
sleep 5
# docker logs -f test-server &
docker logs -f test-server &
# sleep 10
sleep 10
# # Test the endpoint
# curl --max-time 30 localhost:8080/generate \
# -X POST \
# -d '{"inputs":"test message"}' \
# -H 'Content-Type: application/json'
# Test the endpoint
curl --max-time 30 localhost:8080/generate \
-X POST \
-d '{"inputs":"test message"}' \
-H 'Content-Type: application/json'
# # Clean up
# docker stop test-server
# Clean up
docker stop test-server

0 comments on commit 151133e

Please sign in to comment.