Spaces:
Sleeping
Sleeping
Deploy Real Agent Army
Browse files- supervisor.py +10 -0
supervisor.py
CHANGED
|
@@ -67,6 +67,16 @@ class AgentProcess:
|
|
| 67 |
if self.process.poll() is not None:
|
| 68 |
exit_code = self.process.returncode
|
| 69 |
print(f"[{self.name}] Exited immediately with code {exit_code}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
with open(self.log_file, 'a') as f:
|
| 71 |
f.write(f"[{datetime.now()}] Exited immediately with code {exit_code}\n")
|
| 72 |
return False
|
|
|
|
| 67 |
if self.process.poll() is not None:
|
| 68 |
exit_code = self.process.returncode
|
| 69 |
print(f"[{self.name}] Exited immediately with code {exit_code}")
|
| 70 |
+
# Read last few lines of log for debugging
|
| 71 |
+
try:
|
| 72 |
+
with open(self.log_file, 'r') as lf:
|
| 73 |
+
lines = lf.readlines()
|
| 74 |
+
last_lines = lines[-10:] if len(lines) > 10 else lines
|
| 75 |
+
print(f"[{self.name}] Last log lines:")
|
| 76 |
+
for line in last_lines:
|
| 77 |
+
print(f" {line.rstrip()}")
|
| 78 |
+
except:
|
| 79 |
+
pass
|
| 80 |
with open(self.log_file, 'a') as f:
|
| 81 |
f.write(f"[{datetime.now()}] Exited immediately with code {exit_code}\n")
|
| 82 |
return False
|