From ca93e34ee8e577b16e68b56e8ed70ec83ea645ed Mon Sep 17 00:00:00 2001 From: Paul Schwind Date: Mon, 13 Nov 2023 22:42:22 +0100 Subject: [PATCH 1/2] add log --- module_text_cofee/module_text_cofee/adapter.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/module_text_cofee/module_text_cofee/adapter.py b/module_text_cofee/module_text_cofee/adapter.py index 19230bddd..e1f7f9bac 100644 --- a/module_text_cofee/module_text_cofee/adapter.py +++ b/module_text_cofee/module_text_cofee/adapter.py @@ -37,6 +37,17 @@ 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}") + print("json:") + print({ + "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={ From 565975063ecabbb8b3806bd8f52217517b2855f8 Mon Sep 17 00:00:00 2001 From: Paul Schwind Date: Tue, 14 Nov 2023 00:30:49 +0100 Subject: [PATCH 2/2] some debugging attempts --- .vscode/launch.json | 12 ++++-------- docker-compose.cofee.yml | 11 +++++++---- module_text_cofee/module_text_cofee/adapter.py | 11 +++++------ 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 2412d258d..548bc0c22 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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", diff --git a/docker-compose.cofee.yml b/docker-compose.cofee.yml index 875d53993..9f27c6776 100644 --- a/docker-compose.cofee.yml +++ b/docker-compose.cofee.yml @@ -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 @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/module_text_cofee/module_text_cofee/adapter.py b/module_text_cofee/module_text_cofee/adapter.py index e1f7f9bac..75f55476e 100644 --- a/module_text_cofee/module_text_cofee/adapter.py +++ b/module_text_cofee/module_text_cofee/adapter.py @@ -37,8 +37,8 @@ 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}") - print("json:") - print({ + logger.info("json:") + logger.info({ "callbackUrl": f"{module_url}/cofee_callback/{exercise.id}", "submissions": [ { @@ -52,7 +52,7 @@ def send_submissions(exercise: Exercise, submissions: List[Submission]): 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": [ { @@ -66,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")