Skip to content

Commit

Permalink
Add logs output while waiting for Lighthouse to start
Browse files Browse the repository at this point in the history
  • Loading branch information
remyroy committed Sep 2, 2024
1 parent cccdef3 commit 1ae8e66
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions ethwizard/platforms/windows/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -5435,9 +5435,37 @@ def install_lighthouse(base_directory, network, eth1_fallbacks, consensus_checkp
str(nssm_binary), 'start', lighthouse_service_name
])

out_log_read_index = 0
err_log_read_index = 0

delay = 45
log.info(f'We are giving {delay} seconds for the Lighthouse beacon node service to start properly.')
time.sleep(delay)

log_reading_ends = datetime.now() + timedelta(seconds=delay)

while log_reading_ends >= datetime.now():

out_log_text = ''
with open(lighthouse_stdout_log_path, 'r', encoding='utf8') as log_file:
log_file.seek(out_log_read_index)
out_log_text = log_file.read()
out_log_read_index = log_file.tell()

err_log_text = ''
with open(lighthouse_stderr_log_path, 'r', encoding='utf8') as log_file:
log_file.seek(err_log_read_index)
err_log_text = log_file.read()
err_log_read_index = log_file.tell()

out_log_length = len(out_log_text)
if out_log_length > 0:
log.info(out_log_text)

err_log_length = len(err_log_text)
if err_log_length > 0:
log.info(err_log_text)

time.sleep(0.5)

# Verify proper Lighthouse service installation
service_details = get_service_details(nssm_binary, lighthouse_service_name)
Expand Down Expand Up @@ -5506,9 +5534,6 @@ def install_lighthouse(base_directory, network, eth1_fallbacks, consensus_checkp
last_exception = None
last_status_code = None

out_log_read_index = 0
err_log_read_index = 0

while keep_retrying and retry_index < retry_count:
try:
response = httpx.get(cc_query_url, headers=headers)
Expand Down

0 comments on commit 1ae8e66

Please sign in to comment.