Skip to content

Commit 8b2ce40

Browse files
committed
Rearranged methods by importance, dropped debug display values
1 parent 2b2cfb6 commit 8b2ce40

File tree

1 file changed

+13
-25
lines changed
  • cratedb_toolkit/admin/xmover/analysis

1 file changed

+13
-25
lines changed

cratedb_toolkit/admin/xmover/analysis/shard.py

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -859,26 +859,18 @@ def monitor_shards(self, table_filter: str | None, interval_in_seconds: int = 5,
859859

860860
console.print(Panel.fit(f"[bold blue]The {n_shards} Hottest Shards[/bold blue]"))
861861

862-
go_live = False
863-
if go_live:
864-
with Live(self.generate_shards_table(self._get_top_shards(self.latest_shards, n_shards), self.seq_deltas), refresh_per_second=4, console=console) as live_shards:
865-
while True:
866-
sleep(interval_in_seconds)
867-
self.refresh_data()
868-
live_shards.update(self.generate_shards_table(self._get_top_shards(self.latest_shards, n_shards), self.seq_deltas))
869-
else:
870-
iterations = 0
871-
while True:
872-
sleep(interval_in_seconds)
873-
self.refresh_data()
874-
shards_table = self.generate_shards_table(self._get_top_shards(self.latest_shards, n_shards), self.seq_deltas)
875-
console.print(shards_table)
876-
nodes_table = self.generate_nodes_table(self._get_nodes_heat_info(self.reference_shards, self.seq_deltas))
877-
console.print(nodes_table)
878-
879-
iterations += 1
880-
if 0 < repeat <= iterations:
881-
break
862+
iterations = 0
863+
while True:
864+
sleep(interval_in_seconds)
865+
self.refresh_data()
866+
shards_table = self.generate_shards_table(self._get_top_shards(self.latest_shards, n_shards), self.seq_deltas)
867+
console.print(shards_table)
868+
nodes_table = self.generate_nodes_table(self._get_nodes_heat_info(self.reference_shards, self.seq_deltas))
869+
console.print(nodes_table)
870+
871+
iterations += 1
872+
if 0 < repeat <= iterations:
873+
break
882874

883875
def generate_nodes_table(self, heat_nodes_info: dict[str, int]):
884876
table = Table(title="Shard heat by node", box=box.ROUNDED)
@@ -908,8 +900,6 @@ def display_shards_table_header(self):
908900
shards_table.add_column("Size", style="magenta")
909901
shards_table.add_column("Size Delta", style="magenta")
910902
shards_table.add_column("Seq Delta", style="magenta")
911-
shards_table.add_column("DEBUG original Seq no.", style="magenta")
912-
shards_table.add_column("DEBUG Seq no.", style="magenta")
913903
return shards_table
914904

915905
def display_shards_table_rows(self, shards_table: Table, sorted_shards: list[ShardInfo], deltas: dict[str, int]):
@@ -927,9 +917,7 @@ def display_shards_table_rows(self, shards_table: Table, sorted_shards: list[Sha
927917
str(shard.is_primary),
928918
format_size(shard.size_gb),
929919
format_size(self.size_deltas[shard_compound_id]),
930-
str(seq_delta),
931-
str(self.reference_shards[shard_compound_id].seq_stats_max_seq_no),
932-
str(shard.seq_stats_max_seq_no)
920+
str(seq_delta)
933921
)
934922
console.print(shards_table)
935923

0 commit comments

Comments
 (0)