From 1b4b8e8df517cb38d1637c54444ba3ab12286624 Mon Sep 17 00:00:00 2001 From: thesemaphoreslim <47706575+thesemaphoreslim@users.noreply.github.com> Date: Sun, 15 Sep 2024 15:59:32 -0500 Subject: [PATCH] =?UTF-8?q?Fixed=20logging=20for=20fast=20bluebox=20timelo?= =?UTF-8?q?rd=20and=20added=20Visual=20Studio=20(.vs)=E2=80=A6=20(#18558)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed logging for fast bluebox timelord and added Visual Studio (.vs) to gitignore. * Make black CI check happy * Ran through another "black" reformat to pass CI --- .gitignore | 1 + chia/timelord/timelord_launcher.py | 30 +++++++++++++++++++----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 4793b2a8afee..073acb4b8960 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ activate # Editors .vscode .idea +.vs # Packaging chia-blockchain.tar.gz diff --git a/chia/timelord/timelord_launcher.py b/chia/timelord/timelord_launcher.py index b0b68e2f138a..1f2118681dff 100644 --- a/chia/timelord/timelord_launcher.py +++ b/chia/timelord/timelord_launcher.py @@ -110,17 +110,25 @@ async def spawn_process( continue async with process_mgr.manage_proc(proc): - stdout, stderr = await proc.communicate() - if stdout: - log.info(f"VDF client {counter}: {stdout.decode().rstrip()}") - if stderr: - if first_10_seconds: - if time.time() - start_time > 10: - first_10_seconds = False - else: - log.error(f"VDF client {counter}: {stderr.decode().rstrip()}") - - await asyncio.sleep(0.1) + while True: + if proc.stdout is None or proc.stderr is None: + break + if proc.stdout.at_eof() and proc.stderr.at_eof(): + break + stdout = (await proc.stdout.readline()).decode().rstrip() + if stdout: + log.info(f"VDF client {counter}: {stdout}") + stderr = (await proc.stderr.readline()).decode().rstrip() + if stderr: + if first_10_seconds: + if time.time() - start_time > 10: + first_10_seconds = False + else: + log.error(f"VDF client {counter}: {stderr}") + + await asyncio.sleep(0.1) + + await proc.communicate() async def spawn_all_processes(config: Dict, net_config: Dict, process_mgr: VDFClientProcessMgr):