launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25302
[Merge] ~cjwatson/lpbuildbot-worker:flush-stdout into lpbuildbot-worker:main
Colin Watson has proposed merging ~cjwatson/lpbuildbot-worker:flush-stdout into lpbuildbot-worker:main.
Commit message:
Flush stdout more consistently
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/lpbuildbot-worker/+git/lpbuildbot-worker/+merge/390848
Always flushing stdout in _exec before calling "lxc exec" means we don't need to write flush=True everywhere, and makes it easier to avoid missing flushes.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lpbuildbot-worker:flush-stdout into lpbuildbot-worker:main.
diff --git a/create-lp-tests-lxd b/create-lp-tests-lxd
index 5af4d6e..551c4f1 100755
--- a/create-lp-tests-lxd
+++ b/create-lp-tests-lxd
@@ -67,6 +67,7 @@ def _exec(
if user:
command = "sudo su {} -c {}".format(user, shlex.quote(command))
print("{} Running: {}".format(datetime.utcnow().isoformat(), command))
+ sys.stdout.flush()
# This should use `capture_output`, but it's not available in py3.5
if return_stdout:
diff --git a/lp-setup-lxd-build b/lp-setup-lxd-build
index 233e1bf..49a92c9 100755
--- a/lp-setup-lxd-build
+++ b/lp-setup-lxd-build
@@ -30,6 +30,7 @@ def _exec(
if user:
command = "sudo su {} -c {}".format(user, shlex.quote(command))
print("{} Running: {}".format(datetime.utcnow().isoformat(), command))
+ sys.stdout.flush()
# This should use `capture_output`, but it's not available in py3.5
if return_stdout:
@@ -48,7 +49,7 @@ def _exec(
def start_new_container(client, image_name, work_dir):
- print("Creating new container from image", flush=True)
+ print("Creating new container from image")
# At this point, we want the workdir to be mounted so it gets updates
# for future builds
image_data = {
@@ -65,9 +66,9 @@ def start_new_container(client, image_name, work_dir):
"devices": {"build": {"path": work_dir, "source": work_dir, "type": "disk"}},
}
container = client.containers.create(image_data, wait=True)
- print("Starting container", flush=True)
+ print("Starting container")
container.start(wait=True)
- print("Waiting for successful cloud-init", flush=True)
+ print("Waiting for successful cloud-init")
_exec(container, ["cloud-init", "status", "--wait"])
return container
@@ -110,9 +111,9 @@ def copy_workdir_to_container(container, work_dir):
def build_launchpad_in_container(container, work_dir):
- print("Building Launchpad in container", flush=True)
+ print("Building Launchpad in container")
for build_step in BUILD_STEPS:
- print("Build step: {}".format(build_step), flush=True)
+ print("Build step: {}".format(build_step))
_exec(
container,
["make", build_step],
diff --git a/lp-setup-lxd-test b/lp-setup-lxd-test
index 8444810..4514d2a 100755
--- a/lp-setup-lxd-test
+++ b/lp-setup-lxd-test
@@ -23,6 +23,7 @@ def _exec(
if user:
command = "sudo su {} -c {}".format(user, shlex.quote(command))
print("{} Running: {}".format(datetime.utcnow().isoformat(), command))
+ sys.stdout.flush()
# This should use `capture_output`, but it's not available in py3.5
if return_stdout:
@@ -59,7 +60,7 @@ def create_ephemeral_container(
test_container = client.containers.create(instance_config, wait=True)
test_container.start(wait=True)
- print("Waiting for successful cloud-init", flush=True)
+ print("Waiting for successful cloud-init")
_exec(test_container, ["cloud-init", "status", "--wait"])
# ideally this should use pylxd, but getting streaming output from that