Skip to content

Commit

Permalink
expose block id number in apps web page
Browse files Browse the repository at this point in the history
  • Loading branch information
zuston committed Jan 17, 2025
1 parent 9c54187 commit a5010d2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ impl App {
}
}

pub fn reported_block_id_number(&self) -> u64 {
self.block_id_manager.get_blocks_number().unwrap_or(0)
}

pub fn huge_partition_number(&self) -> u64 {
self.huge_partition_number.load(SeqCst)
}
Expand Down
10 changes: 5 additions & 5 deletions src/block_id_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub trait BlockIdManager: Send + Sync {
async fn get_multi_block_ids(&self, ctx: GetMultiBlockIdsContext) -> Result<Bytes>;
async fn report_multi_block_ids(&self, ctx: ReportMultiBlockIdsContext) -> Result<()>;
async fn purge_block_ids(&self, shuffle_id: i32) -> Result<()>;
async fn get_blocks_number(&self) -> Result<u64>;
fn get_blocks_number(&self) -> Result<u64>;
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
Expand Down Expand Up @@ -96,7 +96,7 @@ impl BlockIdManager for PartitionedBlockIdManager {
Ok(())
}

async fn get_blocks_number(&self) -> Result<u64> {
fn get_blocks_number(&self) -> Result<u64> {
let number = self.number.load(SeqCst);
Ok(number)
}
Expand Down Expand Up @@ -165,7 +165,7 @@ impl BlockIdManager for DefaultBlockIdManager {
Ok(())
}

async fn get_blocks_number(&self) -> Result<u64> {
fn get_blocks_number(&self) -> Result<u64> {
Ok(self.number.load(SeqCst))
}
}
Expand Down Expand Up @@ -201,7 +201,7 @@ mod tests {
block_ids: partitioned_block_ids.clone(),
})
.await?;
assert_eq!(100 * 20, manager.get_blocks_number().await?);
assert_eq!(100 * 20, manager.get_blocks_number()?);

// get by one partition
for partition_id in 0..100 {
Expand Down Expand Up @@ -245,7 +245,7 @@ mod tests {

// purge
manager.purge_block_ids(shuffle_id).await?;
assert_eq!(0, manager.get_blocks_number().await?);
assert_eq!(0, manager.get_blocks_number()?);

Ok(())
}
Expand Down
4 changes: 3 additions & 1 deletion src/http/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ fn table() -> Html<String> {
<th>duration (minutes)</th>
<th>resident data (gb)</th>
<th>partition number/huge partition</th>
<th>reported block id number</th>
</tr>
"#
.to_string();
Expand All @@ -73,13 +74,14 @@ fn table() -> Html<String> {
.to_string();

html_content.push_str(&format!(
"<tr><td>{}</td><td>{}</td><td>{}</td><td>{}</td><td>{}/{}</td></tr>",
"<tr><td>{}</td><td>{}</td><td>{}</td><td>{}</td><td>{}/{}</td><td>{}</td></tr>",
app_id,
date,
duration_min,
bytes_to_gb(resident_bytes),
app.partition_number(),
app.huge_partition_number(),
app.reported_block_id_number(),
));
}

Expand Down

0 comments on commit a5010d2

Please sign in to comment.