better erro logging
Build, push image, and notify Watchtower / build-image (push) Successful in 47s
Build, push image, and notify Watchtower / notify (push) Successful in 10s

This commit is contained in:
2026-08-10 16:56:58 +02:00
parent 4abefa5b29
commit 40e91a7d2b
+5 -5
View File
@@ -5,7 +5,7 @@ import uuid
import datetime
import sys
import json
from flask import Flask, request, jsonify
from flask import Flask, request, jsonify, current_app
from pymongo import MongoClient
from APIs import generate, EdamamAPI
from APIs.mqtt import send_command
@@ -79,7 +79,7 @@ async def cooking_params():
f.write(base64.b64decode(camera_image_b64))
data["camera_image"] = filepath
except Exception as e:
print(f"[Error] Failed to save camera image: {str(e)}")
current_app.logger.exception("Failed to save camera image")
return jsonify({"error": f"Failed to save camera image: {str(e)}"}), 500
# 2. Run Vision Safety Check & Cook Planner Concurrently
@@ -98,13 +98,13 @@ async def cooking_params():
safety_result, cook_plan = await asyncio.gather(safety_task, planner_task)
except Exception as e:
print(f"[Error] Exception during safety check or cook planning: {str(e)}")
current_app.logger.exception("Exception during safety check or cook planning")
return jsonify({"error": f"Task execution failed: {str(e)}"}), 500
# 3. Evaluate Safety Result
data["safety_check"] = safety_result
if not safety_result.get("is_safe", True):
print(f"[Safety Warning] Unsafe dish detected: {safety_result}")
current_app.logger.warning(f"Unsafe dish detected: {safety_result}")
return jsonify({
"error": "Safety hazard detected in microwave area",
"is_safe": False,
@@ -123,7 +123,7 @@ async def cooking_params():
return jsonify(cook_plan), 201
except Exception as e:
print(f"[Error] Exception in /cooking-params: {str(e)}")
current_app.logger.exception("Exception in /cooking-params")
@app.route("/telemetry", methods=["POST"])
def telemetry():