Skip to content

Commit d3f45ef

Browse files
committed
Rearranged methods by importance, dropped debug display values
1 parent 97c6305 commit d3f45ef

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
@@ -861,26 +861,18 @@ def monitor_shards(self, table_filter: str | None, interval_in_seconds: int = 5,
861861

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

864-
go_live = False
865-
if go_live:
866-
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:
867-
while True:
868-
sleep(interval_in_seconds)
869-
self.refresh_data()
870-
live_shards.update(self.generate_shards_table(self._get_top_shards(self.latest_shards, n_shards), self.seq_deltas))
871-
else:
872-
iterations = 0
873-
while True:
874-
sleep(interval_in_seconds)
875-
self.refresh_data()
876-
shards_table = self.generate_shards_table(self._get_top_shards(self.latest_shards, n_shards), self.seq_deltas)
877-
console.print(shards_table)
878-
nodes_table = self.generate_nodes_table(self._get_nodes_heat_info(self.reference_shards, self.seq_deltas))
879-
console.print(nodes_table)
880-
881-
iterations += 1
882-
if 0 < repeat <= iterations:
883-
break
864+
iterations = 0
865+
while True:
866+
sleep(interval_in_seconds)
867+
self.refresh_data()
868+
shards_table = self.generate_shards_table(self._get_top_shards(self.latest_shards, n_shards), self.seq_deltas)
869+
console.print(shards_table)
870+
nodes_table = self.generate_nodes_table(self._get_nodes_heat_info(self.reference_shards, self.seq_deltas))
871+
console.print(nodes_table)
872+
873+
iterations += 1
874+
if 0 < repeat <= iterations:
875+
break
884876

885877
def generate_nodes_table(self, heat_nodes_info: dict[str, int]):
886878
table = Table(title="Shard heat by node", box=box.ROUNDED)
@@ -910,8 +902,6 @@ def display_shards_table_header(self):
910902
shards_table.add_column("Size", style="magenta")
911903
shards_table.add_column("Size Delta", style="magenta")
912904
shards_table.add_column("Seq Delta", style="magenta")
913-
shards_table.add_column("DEBUG original Seq no.", style="magenta")
914-
shards_table.add_column("DEBUG Seq no.", style="magenta")
915905
return shards_table
916906

917907
def display_shards_table_rows(self, shards_table: Table, sorted_shards: list[ShardInfo], deltas: dict[str, int]):
@@ -929,9 +919,7 @@ def display_shards_table_rows(self, shards_table: Table, sorted_shards: list[Sha
929919
str(shard.is_primary),
930920
format_size(shard.size_gb),
931921
format_size(self.size_deltas[shard_compound_id]),
932-
str(seq_delta),
933-
str(self.reference_shards[shard_compound_id].seq_stats_max_seq_no),
934-
str(shard.seq_stats_max_seq_no)
922+
str(seq_delta)
935923
)
936924
console.print(shards_table)
937925

0 commit comments

Comments
 (0)