Spaces:
Sleeping
Sleeping
Update inference.py
Browse files- inference.py +20 -6
inference.py
CHANGED
|
@@ -121,10 +121,24 @@ def run_server():
|
|
| 121 |
server.serve_forever()
|
| 122 |
|
| 123 |
if __name__ == "__main__":
|
| 124 |
-
#
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
run_evaluation("hard", num_users=5)
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
server.serve_forever()
|
| 122 |
|
| 123 |
if __name__ == "__main__":
|
| 124 |
+
# 1. Give the internal Docker network time to warm up
|
| 125 |
+
print("[INFO] Warming up network for Phase 2...", flush=True)
|
| 126 |
+
time.sleep(15)
|
|
|
|
| 127 |
|
| 128 |
+
try:
|
| 129 |
+
# 2. Add individual try-blocks for each task level
|
| 130 |
+
for level in ["easy", "medium", "hard"]:
|
| 131 |
+
try:
|
| 132 |
+
run_evaluation(level, num_users=5)
|
| 133 |
+
except Exception as task_err:
|
| 134 |
+
print(f"[ERROR] Task {level} failed: {task_err}", flush=True)
|
| 135 |
+
# Continue to the next task even if one fails
|
| 136 |
+
continue
|
| 137 |
+
|
| 138 |
+
except Exception as e:
|
| 139 |
+
print(f"[ERROR] Critical orchestration failure: {e}", flush=True)
|
| 140 |
+
|
| 141 |
+
finally:
|
| 142 |
+
# 3. CRITICAL: The server MUST start for the Phase 1 Ping to pass
|
| 143 |
+
# even if Phase 2 logic fails.
|
| 144 |
+
run_server()
|