Skip to content
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

Attempt at fixing CoFee submission sending #185

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,28 @@
"type": "python",
"request": "launch",
"cwd": "${workspaceFolder}/assessment_module_manager",
"module": "assessment_module_manager",
"justMyCode": true
"module": "assessment_module_manager"
},
{
"name": "Module Example",
"type": "python",
"request": "launch",
"cwd": "${workspaceFolder}/module_example",
"module": "module_example",
"justMyCode": true
"module": "module_example"
},
{
"name": "Module Programming LLM",
"type": "python",
"request": "launch",
"cwd": "${workspaceFolder}/module_programming_llm",
"module": "module_programming_llm",
"justMyCode": true
"module": "module_programming_llm"
},
{
"name": "Module Text LLM",
"type": "python",
"request": "launch",
"cwd": "${workspaceFolder}/module_text_llm",
"module": "module_text_llm",
"justMyCode": true
"module": "module_text_llm"
},
{
"name": "Module Text CoFee",
Expand Down
11 changes: 7 additions & 4 deletions docker-compose.cofee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ services:
expose:
- 4999
- 8080
# for local debugging, add the following and also change the callbackUrl in adapter.py
ports:
- 80:8000
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./module_text_cofee/traefik.docker.yml:/etc/traefik/traefik.yml
Expand All @@ -28,7 +31,7 @@ services:
# http://localhost/getTask
# http://localhost/sendTaskResult
load-balancer:
image: ghcr.io/ls1intum/athena/load-balancer
image: ghcr.io/ls1intum/athena/load-balancer:2dbf9c8
container_name: cofee-load-balancer
restart: unless-stopped
expose:
Expand All @@ -47,7 +50,7 @@ services:
- traefik.http.routers.balancer.entrypoints=web

segmentation:
image: ghcr.io/ls1intum/athena/segmentation
image: ghcr.io/ls1intum/athena/segmentation:2dbf9c8
container_name: cofee-segmentation
restart: unless-stopped
depends_on:
Expand All @@ -64,7 +67,7 @@ services:
# http://localhost/upload
# http://localhost/feedback_consistency
embedding:
image: ghcr.io/ls1intum/athena/embedding
image: ghcr.io/ls1intum/athena/embedding:2dbf9c8
container_name: cofee-embedding
restart: unless-stopped
depends_on:
Expand All @@ -82,7 +85,7 @@ services:
- traefik.http.services.cofee-embedding.loadbalancer.server.port=8000 # set service name this way

clustering:
image: ghcr.io/ls1intum/athena/clustering
image: ghcr.io/ls1intum/athena/clustering:2dbf9c8
container_name: cofee-clustering
restart: unless-stopped
depends_on:
Expand Down
18 changes: 14 additions & 4 deletions module_text_cofee/module_text_cofee/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,22 @@ def send_submissions(exercise: Exercise, submissions: List[Submission]):
"""Send submissions to old Athena-CoFee server."""
logger.info("Sending %d submissions to CoFee", len(submissions))
module_url = os.environ.get("MODULE_URL", f"http://localhost:{get_module_config().port}")
logger.info("json:")
logger.info({
"callbackUrl": f"{module_url}/cofee_callback/{exercise.id}",
"submissions": [
{
"id": submission.id,
"text": submission.text,
}
for submission in submissions
],
})
resp = requests.post(
f"{get_cofee_url()}/submit",
json={
# TODO: maybe make this more flexible?
# "callbackUrl": f"http://host.docker.internal:5004/cofee_callback/{exercise.id}", # for local debugging
#"callbackUrl": f"http://host.docker.internal:5004/cofee_callback/{exercise.id}", # for local debugging
"callbackUrl": f"{module_url}/cofee_callback/{exercise.id}",
"submissions": [
{
Expand All @@ -55,10 +66,9 @@ def send_submissions(exercise: Exercise, submissions: List[Submission]):
"Content-Type": "application/json",
"Authorization": COFEE_AUTH_TOKEN,
},
timeout=60,
# TODO: remove this again:
verify=False, # Ignore SSL errors for now, because athenetest1-01 has an invalid certificate
# timeout=60,
)
logger.info("sent! raising for status...")
resp.raise_for_status()
logger.info("Submissions sent to CoFee")

Expand Down
Loading