fix log error
Browse files- lib/app_runner.py +2 -2
- lib/report.py +5 -5
lib/app_runner.py
CHANGED
|
@@ -47,7 +47,7 @@ class AppRunner:
|
|
| 47 |
if log_path.exists():
|
| 48 |
log_path.unlink(missing_ok=True)
|
| 49 |
|
| 50 |
-
def wait_for_app_start(self, log_file, timeout =
|
| 51 |
for i in range(int(timeout/interval)):
|
| 52 |
ret = subprocess.run(f"tail -n 10 {log_file}", check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
| 53 |
universal_newlines=True)
|
|
@@ -57,7 +57,7 @@ class AppRunner:
|
|
| 57 |
# print(ret.stdout)
|
| 58 |
print(f"app is not started yet, retry {i+1}...")
|
| 59 |
time.sleep(interval)
|
| 60 |
-
|
| 61 |
|
| 62 |
def stop(self):
|
| 63 |
pgid = os.getpgid(self.sub_proc.pid)
|
|
|
|
| 47 |
if log_path.exists():
|
| 48 |
log_path.unlink(missing_ok=True)
|
| 49 |
|
| 50 |
+
def wait_for_app_start(self, log_file, timeout = 60, interval=3):
|
| 51 |
for i in range(int(timeout/interval)):
|
| 52 |
ret = subprocess.run(f"tail -n 10 {log_file}", check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
| 53 |
universal_newlines=True)
|
|
|
|
| 57 |
# print(ret.stdout)
|
| 58 |
print(f"app is not started yet, retry {i+1}...")
|
| 59 |
time.sleep(interval)
|
| 60 |
+
raise RuntimeError(f"app not started in {timeout}s")
|
| 61 |
|
| 62 |
def stop(self):
|
| 63 |
pgid = os.getpgid(self.sub_proc.pid)
|
lib/report.py
CHANGED
|
@@ -193,14 +193,14 @@ class DelayItem:
|
|
| 193 |
if row.web_freq:
|
| 194 |
web_freq.append(row.web_freq)
|
| 195 |
|
| 196 |
-
summary.avg_audio_len = sum(audio_len) / len(audio_len)
|
| 197 |
summary.total_tsb = sum(total_tsb)
|
| 198 |
-
summary.avg_tsb_per_second = sum(avg_tsb_per_second) / len(avg_tsb_per_second)
|
| 199 |
summary.total_tsl = sum(total_tsl)
|
| 200 |
-
summary.avg_tsl_per_second = sum(avg_tsl_per_second) / len(avg_tsl_per_second)
|
| 201 |
summary.total_web = sum(total_web)
|
| 202 |
-
summary.avg_web_per_second = sum(avg_web_per_second) / len(avg_web_per_second)
|
| 203 |
-
summary.avg_web_freq = sum(web_freq) /len(web_freq)
|
| 204 |
return summary
|
| 205 |
|
| 206 |
|
|
|
|
| 193 |
if row.web_freq:
|
| 194 |
web_freq.append(row.web_freq)
|
| 195 |
|
| 196 |
+
summary.avg_audio_len = sum(audio_len) / len(audio_len) if len(audio_len)>0 else 0
|
| 197 |
summary.total_tsb = sum(total_tsb)
|
| 198 |
+
summary.avg_tsb_per_second = sum(avg_tsb_per_second) / len(avg_tsb_per_second) if len(avg_tsb_per_second)>0 else 0
|
| 199 |
summary.total_tsl = sum(total_tsl)
|
| 200 |
+
summary.avg_tsl_per_second = sum(avg_tsl_per_second) / len(avg_tsl_per_second) if len(avg_tsl_per_second)>0 else 0
|
| 201 |
summary.total_web = sum(total_web)
|
| 202 |
+
summary.avg_web_per_second = sum(avg_web_per_second) / len(avg_web_per_second) if len(avg_web_per_second)>0 else 0
|
| 203 |
+
summary.avg_web_freq = sum(web_freq) /len(web_freq) if len(web_freq)>0 else 0
|
| 204 |
return summary
|
| 205 |
|
| 206 |
|