Skip to content

Commit

Permalink
change print to sys.stdout.write and flush in benchmark_runner.py (#2155
Browse files Browse the repository at this point in the history
)

* change print to sys.stdout.write and flush in benchmark_runner.py

* use print with flush arg instead of sys.stdout.write and flush

---------

Co-authored-by: Russell Liu <russell.liu@uwaterloo.ca>
  • Loading branch information
russell-liu and Russell Liu committed Oct 6, 2023
1 parent ed08557 commit a8685f8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion benchmark/benchmark_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def run_kuzu(serialized_graph_path):
process = subprocess.Popen(
tuple(benchmark_cmd), stdout=subprocess.PIPE)
for line in iter(process.stdout.readline, b''):
print(line.decode("utf-8"), end='')
print(line.decode("utf-8"), end='', flush=True)
process.wait()
if process.returncode != 0:
print()
Expand Down
3 changes: 1 addition & 2 deletions benchmark/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ def serialize(dataset_name, dataset_path, serialized_graph_path, benchmark_copy_
filename = table_types[copy_match.group(1)] + '-' + copy_match.group(1).replace('_', '-') + '_log.txt'
with open(os.path.join(benchmark_copy_log_dir, filename), 'ab') as f:
for line in iter(process.stdout.readline, b''):
sys.stdout.write(line.decode("utf-8"))
sys.stdout.flush()
print(line.decode("utf-8"), end='', flush=True)
f.write(line)
process.wait()
if process.returncode != 0:
Expand Down

0 comments on commit a8685f8

Please sign in to comment.