-
Notifications
You must be signed in to change notification settings - Fork 328
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
feat(tasks): add --timings option for run command #1536
Conversation
fcc8c3b
to
9c17be8
Compare
let's just call it |
9c17be8
to
b90c429
Compare
b90c429
to
1f59079
Compare
efc32b7
to
64a153d
Compare
@roele yeah I figured that would happen since we are streaming stdout/stderr; was just getting lucky on my test runs. How would you feel about just adding a summary report of timings after all parallel execution? |
64a153d
to
ca165c3
Compare
@roele cool, added prefixes for now just so folks can review what it would look like. In parallel I'll play around with summary formats. |
ca165c3
to
82e6379
Compare
@roele I have a quick summary table implementation here if you wanted to review/refine it. After looking at it I feel like hacking a table on to the default output doesn't look right. I think a |
@@ -107,8 +108,15 @@ pub struct Run { | |||
#[clap(long, short, verbatim_doc_comment)] | |||
pub raw: bool, | |||
|
|||
/// Shows elapsed time after each task | |||
#[clap(long, alias = "timing", verbatim_doc_comment)] | |||
pub timings: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after looking at this I am considering if maybe we just want to always display the timings. Not sure though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel in either case it should interfere less with the actual command output by maybe showing the entire line (after prefix) dimmed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still undecided on this. I think I'm leaning towards always displaying though curious if you all have any thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm maybe not. Let's keep it optional for now, I think we should err on the side of less noise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the other choice is optional, but default to enabled. Seems reasonable however to just take user feedback and make a final decision before tasks are a GA feature.
I might be not understanding this so much but I think this could be simplified by doing something like this: fn run_all() {
let start = time::Instant::now()
for task in tasks {
task.run();
}
println!("elapsed all: ...")
}
fn run_task() {
let start = time::Instant::now()
run()
println!("elapsed: ...")
} then we wouldn't need to modify anything outside of the cli command or use any mutexes or anything |
Correct, the only reason to have |
@Ajpantuso you're right it looks a bit odd. So i guess we should start small by refining the current inline approach. |
8797e92
to
3f69d58
Compare
src/cli/run.rs
Outdated
@@ -195,6 +201,11 @@ impl Run { | |||
run(&task); | |||
} | |||
}); | |||
|
|||
if self.timings { | |||
miseprintln!("finished in {}", format_duration(timer.elapsed())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's wrap this in style::edim()
also we should only display it if there are >1 tasks. Lastly, let's put it on stderr. I could make a case for stderr or stdout but we're already using stderr for the task start message so I think stderr makes sense for this to match.
EDIT: we probably only want to do that if we make it non-optionalinfo_unprefix_trunc
is what you'll want to use for this since that will respect the log level and hide the output under --quiet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, used info!
so the dim mise
prefix is added, but I think that makes sense.
3f69d58
to
8f0b876
Compare
Summary
Closed #1265
Adds a
--show-timings
option to themise run
command to display elapsed time after each task.Open Questions