Skip to content

Commit

Permalink
Log when waiting for a long time (new epochs)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoura committed Sep 21, 2020
1 parent 947f5ef commit e0ec69e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
14 changes: 10 additions & 4 deletions cardano_node_tests/utils/clusterlib.py
Expand Up @@ -1314,18 +1314,24 @@ def wait_for_new_epoch(self, new_epochs: int = 1, padding_seconds: int = 0) -> N
return

last_block_epoch = self.get_last_block_epoch()
expected_epoch_no = last_block_epoch + new_epochs

LOGGER.debug(
f"Current epoch: {last_block_epoch}; Waiting the beginning of epoch: "
"{last_block_epoch + new_epochs}"
f"Current epoch: {last_block_epoch}; Waiting for the beginning of epoch: "
"{expected_epoch_no}"
)

expected_epoch_no = last_block_epoch + new_epochs

# how many seconds to wait until start of the expected epoch
sleep_slots = (
last_block_epoch + new_epochs
) * self.epoch_length - self.get_last_block_slot_no()
sleep_time = int(sleep_slots * self.slot_length) + (padding_seconds or 1)

if sleep_time > 15:
LOGGER.info(
f"Waiting for {sleep_time} sec for start of the epoch no {expected_epoch_no}"
)

time.sleep(sleep_time)

wakeup_epoch = self.get_last_block_epoch()
Expand Down
5 changes: 1 addition & 4 deletions cardano_node_tests/utils/helpers.py
Expand Up @@ -647,10 +647,7 @@ def update_params(

cluster_obj.submit_update_proposal(cli_args=[cli_arg, str(param_value)])

LOGGER.info(
f"Update Proposal submitted (cli_arg={cli_arg}, param_value={param_value}). "
"Sleeping until next epoch."
)
LOGGER.info(f"Update Proposal submitted (cli_arg={cli_arg}, param_value={param_value})")
cluster_obj.wait_for_new_epoch()

updated_value = cluster_obj.get_protocol_params()[param_name]
Expand Down

0 comments on commit e0ec69e

Please sign in to comment.