Ben Burtenshaw commited on
Commit
8e226e6
·
1 Parent(s): 95a3fa7

use readline in logger

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -11,14 +11,14 @@ def run():
11
  import sys
12
 
13
  with open("out-file.txt", "w") as f:
14
- proc = subprocess.Popen(
15
  [f"{sys.executable}", "prometheus_pipeline.py"],
16
  stdout=subprocess.PIPE,
17
  )
18
 
19
  content = ""
20
 
21
- for line in proc.stdout:
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:]