Spaces:
Sleeping
Sleeping
Ben Burtenshaw
commited on
Commit
·
8e226e6
1
Parent(s):
95a3fa7
use readline in logger
Browse files
app.py
CHANGED
@@ -11,14 +11,14 @@ def run():
|
|
11 |
import sys
|
12 |
|
13 |
with open("out-file.txt", "w") as f:
|
14 |
-
|
15 |
[f"{sys.executable}", "prometheus_pipeline.py"],
|
16 |
stdout=subprocess.PIPE,
|
17 |
)
|
18 |
|
19 |
content = ""
|
20 |
|
21 |
-
for line in
|
22 |
content = content.split("\n")
|
23 |
content.append(line.decode("utf-8"))
|
24 |
content = content[-10:]
|
|
|
11 |
import sys
|
12 |
|
13 |
with open("out-file.txt", "w") as f:
|
14 |
+
process = subprocess.Popen(
|
15 |
[f"{sys.executable}", "prometheus_pipeline.py"],
|
16 |
stdout=subprocess.PIPE,
|
17 |
)
|
18 |
|
19 |
content = ""
|
20 |
|
21 |
+
for line in iter(process.stdout.readline, ""):
|
22 |
content = content.split("\n")
|
23 |
content.append(line.decode("utf-8"))
|
24 |
content = content[-10:]
|