Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ignore from 0.4.17 to 0.4.20 in /src/rust/engine #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/rust/engine/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/rust/engine/fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dirs-next = "2"
futures = "0.3"
glob = "0.2.11"
hashing = { path = "../hashing" }
ignore = "0.4.11"
ignore = "0.4.20"
lazy_static = "1"
log = "0.4"
parking_lot = "0.11"
Expand Down
12 changes: 8 additions & 4 deletions src/rust/engine/ui/src/console_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,21 @@ impl ConsoleUI {
}

fn get_label_from_heavy_hitters(
tasks_to_display: &IndexMap<SpanId, (String, Option<Duration>)>,
tasks_to_display: &IndexMap<SpanId, (String, Option<String>, Option<Duration>)>,
index: usize,
) -> Option<String> {
tasks_to_display
.get_index(index)
.map(|(_, (label, maybe_duration))| {
.map(|(_, (label, maybe_goalname, maybe_duration))| {
let duration_label = match maybe_duration {
None => "(Waiting) ".to_string(),
Some(duration) => format_workunit_duration(*duration),
};
format!("{}{}", duration_label, label)
let goal_label = match maybe_goalname {
None => "".to_string(),
Some(label) => format!("[{}] ", label.clone()),
};
format!("{}{}{}", duration_label, goal_label, label)
})
}

Expand Down Expand Up @@ -236,7 +240,7 @@ type MultiProgressTask = Pin<Box<dyn Future<Output = std::io::Result<()>> + Send

/// The state for one run of the ConsoleUI.
struct Instance {
tasks_to_display: IndexMap<SpanId, (String, Option<Duration>)>,
tasks_to_display: IndexMap<SpanId, (String, Option<String>, Option<Duration>)>,
multi_progress_task: MultiProgressTask,
bars: Vec<ProgressBar>,
}
28 changes: 24 additions & 4 deletions src/rust/engine/workunit_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ impl HeavyHittersData {
}
}

fn heavy_hitters(&self, k: usize) -> HashMap<SpanId, (String, Option<Duration>)> {
fn heavy_hitters(&self, k: usize) -> HashMap<SpanId, (String, Option<String>, Option<Duration>)> {
self.refresh_store();

let now = SystemTime::now();
Expand Down Expand Up @@ -460,8 +460,11 @@ impl HeavyHittersData {
let workunit = inner.workunit_records.get(&span_id).unwrap();
if let Some(effective_name) = workunit.metadata.desc.as_ref() {
let maybe_duration = Self::duration_for(now, workunit);

res.insert(span_id, (effective_name.to_string(), maybe_duration));
let maybe_goal_name = goal_parent_name(&inner.workunit_records, Some(span_id));
res.insert(
span_id,
(effective_name.to_string(), maybe_goal_name, maybe_duration),
);
if res.len() >= k {
break;
}
Expand Down Expand Up @@ -558,6 +561,20 @@ fn first_matched_parent(
None
}

fn goal_parent_name(
workunit_records: &HashMap<SpanId, Workunit>,
mut span_id: Option<SpanId>,
) -> Option<String> {
let mut ret: Option<String> = None;
let mut workunit: Option<&Workunit> = None;
while let Some(current_span_id) = span_id {
ret = workunit.map(|wu| wu.name.rsplit('.').next().unwrap().to_string());
workunit = workunit_records.get(&current_span_id);
span_id = workunit.and_then(|workunit| workunit.parent_id);
}
ret
}

impl WorkunitStore {
pub fn new(log_starting_workunits: bool) -> WorkunitStore {
WorkunitStore {
Expand Down Expand Up @@ -588,7 +605,10 @@ impl WorkunitStore {
///
/// Find the longest running leaf workunits, and return their first visible parents.
///
pub fn heavy_hitters(&self, k: usize) -> HashMap<SpanId, (String, Option<Duration>)> {
pub fn heavy_hitters(
&self,
k: usize,
) -> HashMap<SpanId, (String, Option<String>, Option<Duration>)> {
self.heavy_hitters_data.heavy_hitters(k)
}

Expand Down