Skip to content

Commit

Permalink
Benchmarks: Simplified builder
Browse files Browse the repository at this point in the history
  • Loading branch information
francis-clairicia committed Sep 29, 2024
1 parent fecf422 commit e81b9fc
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions benchmark_server/build_benchmark_image
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from __future__ import annotations

import argparse
import functools
import os
import shutil
import subprocess
Expand Down Expand Up @@ -71,18 +70,13 @@ def _build_docker_image(client: docker.DockerClient, sdist_path: Path, tag: str,
stderr=subprocess.STDOUT,
text=True,
) as process:
try:
assert process.stdout is not None
for c in iter(functools.partial(process.stdout.read, 1), ""):
sys.stdout.write(c)
sys.stdout.flush()
retcode = process.wait()
except BaseException: # Including KeyboardInterrupt, communicate handled that.
process.kill()
# We don't call process.wait() as .__exit__ does that for us.
raise
if retcode != 0:
sys.exit(retcode)
assert process.stdout is not None
while c := process.stdout.read(1):
sys.stdout.write(c)
sys.stdout.flush()

if (retcode := process.returncode) != 0:
sys.exit(retcode)

client.images.prune(filters={"dangling": True})
print(f"-> Sucessfully built docker image {tag!r}")
Expand Down

0 comments on commit e81b9fc

Please sign in to comment.