Commit ·
88ffd96
1
Parent(s): 484857e
port changes
Browse files- Dockerfile +4 -4
- README.md +6 -6
- inference.py +2 -2
- server/main.py +1 -1
- smoke_test.py +2 -2
Dockerfile
CHANGED
|
@@ -12,11 +12,11 @@ COPY baseline_runner.py .
|
|
| 12 |
COPY inference.py .
|
| 13 |
COPY openenv.yaml .
|
| 14 |
|
| 15 |
-
# HuggingFace Spaces expects port
|
| 16 |
-
EXPOSE
|
| 17 |
|
| 18 |
# Health check
|
| 19 |
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
| 20 |
-
CMD python -c "import requests; requests.get('http://localhost:
|
| 21 |
|
| 22 |
-
CMD ["python", "-m", "uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "
|
|
|
|
| 12 |
COPY inference.py .
|
| 13 |
COPY openenv.yaml .
|
| 14 |
|
| 15 |
+
# HuggingFace Spaces expects port 8000
|
| 16 |
+
EXPOSE 8000
|
| 17 |
|
| 18 |
# Health check
|
| 19 |
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
| 20 |
+
CMD python -c "import requests; requests.get('http://localhost:8000/')" || exit 1
|
| 21 |
|
| 22 |
+
CMD ["python", "-m", "uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🔧
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
-
app_port:
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
|
@@ -266,14 +266,14 @@ This dense reward signal helps RL agents learn faster than sparse pass/fail grad
|
|
| 266 |
|
| 267 |
```bash
|
| 268 |
# 1. Start an episode
|
| 269 |
-
curl -X POST http://localhost:
|
| 270 |
-H "Content-Type: application/json" \
|
| 271 |
-d '{"task_id": "dockerfile_syntax", "scenario_id": "typo_filename"}'
|
| 272 |
|
| 273 |
# Response: observation with broken Dockerfile + error message
|
| 274 |
|
| 275 |
# 2. Fix the typo
|
| 276 |
-
curl -X POST http://localhost:
|
| 277 |
-H "Content-Type: application/json" \
|
| 278 |
-d '{
|
| 279 |
"action": {
|
|
@@ -289,7 +289,7 @@ curl -X POST http://localhost:7860/step \
|
|
| 289 |
# Response: reward=0.4, issues_fixed=1/1
|
| 290 |
|
| 291 |
# 3. Submit
|
| 292 |
-
curl -X POST http://localhost:
|
| 293 |
-H "Content-Type: application/json" \
|
| 294 |
-d '{"action": {"action_type": "submit"}}'
|
| 295 |
|
|
@@ -322,7 +322,7 @@ This shows the environment is both **solvable** (3 perfect scores) and **challen
|
|
| 322 |
|
| 323 |
```bash
|
| 324 |
pip install -r requirements.txt
|
| 325 |
-
python -m uvicorn server.main:app --host 0.0.0.0 --port
|
| 326 |
```
|
| 327 |
|
| 328 |
### Run Tests
|
|
@@ -335,7 +335,7 @@ pytest tests/ -v
|
|
| 335 |
|
| 336 |
```bash
|
| 337 |
docker build -t cicd-docker-env .
|
| 338 |
-
docker run -p
|
| 339 |
```
|
| 340 |
|
| 341 |
### Baseline Inference (with LLM)
|
|
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 8000
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
|
|
|
| 266 |
|
| 267 |
```bash
|
| 268 |
# 1. Start an episode
|
| 269 |
+
curl -X POST http://localhost:8000/reset \
|
| 270 |
-H "Content-Type: application/json" \
|
| 271 |
-d '{"task_id": "dockerfile_syntax", "scenario_id": "typo_filename"}'
|
| 272 |
|
| 273 |
# Response: observation with broken Dockerfile + error message
|
| 274 |
|
| 275 |
# 2. Fix the typo
|
| 276 |
+
curl -X POST http://localhost:8000/step \
|
| 277 |
-H "Content-Type: application/json" \
|
| 278 |
-d '{
|
| 279 |
"action": {
|
|
|
|
| 289 |
# Response: reward=0.4, issues_fixed=1/1
|
| 290 |
|
| 291 |
# 3. Submit
|
| 292 |
+
curl -X POST http://localhost:8000/step \
|
| 293 |
-H "Content-Type: application/json" \
|
| 294 |
-d '{"action": {"action_type": "submit"}}'
|
| 295 |
|
|
|
|
| 322 |
|
| 323 |
```bash
|
| 324 |
pip install -r requirements.txt
|
| 325 |
+
python -m uvicorn server.main:app --host 0.0.0.0 --port 8000
|
| 326 |
```
|
| 327 |
|
| 328 |
### Run Tests
|
|
|
|
| 335 |
|
| 336 |
```bash
|
| 337 |
docker build -t cicd-docker-env .
|
| 338 |
+
docker run -p 8000:8000 cicd-docker-env
|
| 339 |
```
|
| 340 |
|
| 341 |
### Baseline Inference (with LLM)
|
inference.py
CHANGED
|
@@ -27,7 +27,7 @@ from openai import OpenAI
|
|
| 27 |
API_BASE_URL = os.environ.get("API_BASE_URL", "https://router.huggingface.co/v1")
|
| 28 |
MODEL_NAME = os.environ.get("MODEL_NAME", "meta-llama/Llama-3.1-70B-Instruct")
|
| 29 |
HF_TOKEN = os.environ.get("HF_TOKEN", "")
|
| 30 |
-
ENV_URL = os.environ.get("ENV_URL", "http://localhost:
|
| 31 |
MAX_STEPS = 8 # leave 2 steps buffer before env hard-limit of 10
|
| 32 |
|
| 33 |
SYSTEM_PROMPT = """You are an expert DevOps engineer debugging CI/CD pipelines.
|
|
@@ -294,7 +294,7 @@ def main():
|
|
| 294 |
print(f"\nERROR: Cannot connect to environment at {ENV_URL}")
|
| 295 |
print(f" {e}")
|
| 296 |
print("\nStart the server first:")
|
| 297 |
-
print(" python -m uvicorn server.main:app --host 0.0.0.0 --port
|
| 298 |
sys.exit(1)
|
| 299 |
|
| 300 |
client = create_client()
|
|
|
|
| 27 |
API_BASE_URL = os.environ.get("API_BASE_URL", "https://router.huggingface.co/v1")
|
| 28 |
MODEL_NAME = os.environ.get("MODEL_NAME", "meta-llama/Llama-3.1-70B-Instruct")
|
| 29 |
HF_TOKEN = os.environ.get("HF_TOKEN", "")
|
| 30 |
+
ENV_URL = os.environ.get("ENV_URL", "http://localhost:8000")
|
| 31 |
MAX_STEPS = 8 # leave 2 steps buffer before env hard-limit of 10
|
| 32 |
|
| 33 |
SYSTEM_PROMPT = """You are an expert DevOps engineer debugging CI/CD pipelines.
|
|
|
|
| 294 |
print(f"\nERROR: Cannot connect to environment at {ENV_URL}")
|
| 295 |
print(f" {e}")
|
| 296 |
print("\nStart the server first:")
|
| 297 |
+
print(" python -m uvicorn server.main:app --host 0.0.0.0 --port 8000")
|
| 298 |
sys.exit(1)
|
| 299 |
|
| 300 |
client = create_client()
|
server/main.py
CHANGED
|
@@ -227,4 +227,4 @@ async def run_baseline(request: Optional[BaselineRequest] = None):
|
|
| 227 |
|
| 228 |
|
| 229 |
if __name__ == "__main__":
|
| 230 |
-
uvicorn.run(app, host="0.0.0.0", port=
|
|
|
|
| 227 |
|
| 228 |
|
| 229 |
if __name__ == "__main__":
|
| 230 |
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
smoke_test.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
Usage:
|
| 4 |
.\\.venv\\Scripts\\python.exe smoke_test.py
|
| 5 |
-
.\\.venv\\Scripts\\python.exe smoke_test.py --mode live --base-url http://127.0.0.1:
|
| 6 |
|
| 7 |
Modes:
|
| 8 |
- inprocess (default): uses FastAPI TestClient, no running server needed.
|
|
@@ -218,7 +218,7 @@ def run_smoke(client: EndpointClient) -> int:
|
|
| 218 |
def main() -> int:
|
| 219 |
parser = argparse.ArgumentParser(description="Smoke test CI/CD Debug FastAPI server")
|
| 220 |
parser.add_argument("--mode", choices=["inprocess", "live"], default="inprocess")
|
| 221 |
-
parser.add_argument("--base-url", default="http://127.0.0.1:
|
| 222 |
args = parser.parse_args()
|
| 223 |
|
| 224 |
if args.mode == "inprocess":
|
|
|
|
| 2 |
|
| 3 |
Usage:
|
| 4 |
.\\.venv\\Scripts\\python.exe smoke_test.py
|
| 5 |
+
.\\.venv\\Scripts\\python.exe smoke_test.py --mode live --base-url http://127.0.0.1:8000
|
| 6 |
|
| 7 |
Modes:
|
| 8 |
- inprocess (default): uses FastAPI TestClient, no running server needed.
|
|
|
|
| 218 |
def main() -> int:
|
| 219 |
parser = argparse.ArgumentParser(description="Smoke test CI/CD Debug FastAPI server")
|
| 220 |
parser.add_argument("--mode", choices=["inprocess", "live"], default="inprocess")
|
| 221 |
+
parser.add_argument("--base-url", default="http://127.0.0.1:8000")
|
| 222 |
args = parser.parse_args()
|
| 223 |
|
| 224 |
if args.mode == "inprocess":
|