Skip to content

Commit e785d32

Browse files
Jason Barnettclaude
andcommitted
revert: remove log_duration flag now that #23251 fixed the root cause
PR #23251 fixed the "Scheduling:" workunit being promoted to INFO, so the log_duration mechanism to suppress duplicate durations is no longer needed. Duration is now shown unconditionally for completed and canceled workunits. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 38ea727 commit e785d32

File tree

3 files changed

+11
-40
lines changed

3 files changed

+11
-40
lines changed

src/rust/engine/src/nodes/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,14 +493,12 @@ impl Node for NodeKey {
493493
NodeKey::Task(task) => Some(&task.params),
494494
_ => None,
495495
};
496-
let log_duration = !matches!(self, NodeKey::ExecuteProcess(..));
497496
let context2 = context.clone();
498497

499498
in_workunit!(
500499
workunit_name,
501500
self.workunit_level(),
502501
desc = workunit_desc.clone(),
503-
log_duration = log_duration,
504502
user_metadata = {
505503
if let Some(params) = maybe_params {
506504
Python::attach(|py| {

src/rust/workunit_store/src/lib.rs

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -275,20 +275,16 @@ impl Workunit {
275275
self.name
276276
};
277277

278-
let duration_suffix: Option<String> = if metadata.log_duration {
279-
match &self.state {
280-
WorkunitState::Completed { time_span } => Some(format!(
281-
" ({})",
282-
format_workunit_duration(Duration::from(time_span.duration))
283-
)),
284-
WorkunitState::Started { start_time, .. } if canceled => Some(format!(
285-
" ({})",
286-
format_workunit_duration(start_time.elapsed().unwrap_or_default())
287-
)),
288-
_ => None,
289-
}
290-
} else {
291-
None
278+
let duration_suffix: Option<String> = match &self.state {
279+
WorkunitState::Completed { time_span } => Some(format!(
280+
" ({})",
281+
format_workunit_duration(Duration::from(time_span.duration))
282+
)),
283+
WorkunitState::Started { start_time, .. } if canceled => Some(format!(
284+
" ({})",
285+
format_workunit_duration(start_time.elapsed().unwrap_or_default())
286+
)),
287+
_ => None,
292288
};
293289

294290
/* This length calculation doesn't treat multi-byte unicode charcters identically
@@ -360,7 +356,7 @@ pub enum ArtifactOutput {
360356
Snapshot(Arc<dyn DirectoryDigest>),
361357
}
362358

363-
#[derive(Clone, Debug)]
359+
#[derive(Clone, Debug, Default)]
364360
pub struct WorkunitMetadata {
365361
pub desc: Option<String>,
366362
pub message: Option<String>,
@@ -372,25 +368,6 @@ pub struct WorkunitMetadata {
372368
pub remote_action: Option<hashing::Digest>,
373369
pub artifacts: Vec<(String, ArtifactOutput)>,
374370
pub user_metadata: Vec<(String, UserMetadataItem)>,
375-
pub log_duration: bool,
376-
}
377-
378-
impl Default for WorkunitMetadata {
379-
fn default() -> Self {
380-
Self {
381-
desc: None,
382-
message: None,
383-
stdout: None,
384-
stderr: None,
385-
local_command: None,
386-
local_action: None,
387-
remote_command: None,
388-
remote_action: None,
389-
artifacts: Vec::new(),
390-
user_metadata: Vec::new(),
391-
log_duration: true,
392-
}
393-
}
394371
}
395372

396373
/// Abstract id for passing user metadata items around

src/rust/workunit_store/src/tests.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,3 @@ fn format_duration_over_one_hour() {
283283
assert_eq!(format_workunit_duration(Duration::from_secs_f64(5445.5)), "90m 45.5s");
284284
}
285285

286-
#[test]
287-
fn workunit_metadata_defaults_log_duration_to_true() {
288-
assert!(WorkunitMetadata::default().log_duration);
289-
}

0 commit comments

Comments
 (0)