| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4392/ |
|
Review request for pants-reviews, Benjy Weinberger, Kris Wilson, Stu Hood, and Yujie Chen.
By Nick Howard (Twitter).
Repository:
pants
Description
Testing
Diffs
|
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4392/ |
Fix it, then Ship it!
Thanks Nick!
| src/python/pants/engine/scheduler.py (Diff revision 1) | |||
|---|---|---|---|
| 212 | def trace(self, roots): |
213 | def trace(self, roots): |
The
rootsarg is unused now, which is (IMO) fine. But should remove it, or replace it with passing in and validating therequestsimilar to whatdef root_entriesdoes.
| src/python/pants/engine/subsystem/native.py (Diff revision 1) | |||
|---|---|---|---|
| 137 | char* graph_trace(RawScheduler*, char*); |
||
This is now a
voidfunction.
| src/rust/engine/src/graph.rs (Diff revision 1) | |||
|---|---|---|---|
| 261 | <</** |
262 | /** |
| 263 | * Begins a topological walk from the given roots. Provides both the current entry as well as the |
||
| 264 | * depth from the root. |
||
| 265 | */ |
||
two-space indentation probably
| src/rust/engine/src/graph.rs (Diff revision 1) | |||
|---|---|---|---|
| 427 | for _ in 0..level { |
||
| 428 | indent = indent + " "; |
||
Maybe better with
indent.push(' ')?
| src/rust/engine/src/graph.rs (Diff revision 1) | |||
|---|---|---|---|
| 437 | match entry.node.product() { |
||
| 438 | ref x => format!("{}", externs.id_to_str(x.0)) |
||
| 439 | }, |
||
| 440 | match entry.node.subject() { |
||
| 441 | ref x => format!("{}", externs.id_to_str(x.id())) |
||
| 442 | }); |
||
If you're trying to ref/deref something, you can just use the
*or&operators, similar to C/C++. So I think each of these matches should just be:externs.id_to_str(*entry.node.product())Also, you shouldn't need the second
format!call in here, since the result is already a string.
| src/rust/engine/src/graph.rs (Diff revision 1) | |||
|---|---|---|---|
| 444 | format!("{}\n{} {}", output, indent, match entry.state { |
||
| 445 | Some(Complete::Return(ref x)) => format!("Return({})", externs.val_to_str(x)), |
||
| 446 | Some(Complete::Throw(ref x)) => format!("Throw({:?})", x), |
||
| 447 | Some(Complete::Noop(ref x, ref opt_node)) => format!("Noop({:?}, {:?})", x, opt_node), |
||
| 448 | None => String::new(), |
||
| 449 | }) |
||
Not a fan of the inline match like this, as opposed to breaking it out and naming it. But minor.
| src/rust/engine/src/lib.rs (Diff revision 1) | |||
|---|---|---|---|
| 459 | let path_str = unsafe { CStr::from_ptr(path_ptr).to_string_lossy().into_owned() }; |
||
| 460 | let path = Path::new(path_str.as_str()); |
||
| 461 | with_scheduler(scheduler_ptr, |raw| { |
||
two-space indent
- Stu Hood
On November 18th, 2016, 8:56 p.m. UTC, Nick Howard (Twitter) wrote:
|
Review request for pants-reviews, Benjy Weinberger, Kris Wilson, Stu Hood, and Yujie Chen.
By Nick Howard (Twitter).
|
Updated Nov. 18, 2016, 8:56 p.m. |
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4392/ |
On November 18th, 2016, 2:47 p.m. MST, Stu Hood wrote:
src/python/pants/engine/scheduler.py (Diff revision 1) 212 def trace(self, roots):213 def trace(self, roots):The
rootsarg is unused now, which is (IMO) fine. But should remove it, or replace it with passing in and validating therequestsimilar to whatdef root_entriesdoes.
I think I'll just rm it for now.
On November 18th, 2016, 2:47 p.m. MST, Stu Hood wrote:
src/rust/engine/src/graph.rs (Diff revision 1) 427 for _ in 0..level {428 indent = indent + " ";Maybe better with
indent.push(' ')?
Neat. I went with
push_str.
On November 18th, 2016, 2:47 p.m. MST, Stu Hood wrote:
src/rust/engine/src/graph.rs (Diff revision 1) 437 match entry.node.product() {438 ref x => format!("{}", externs.id_to_str(x.0))439 },440 match entry.node.subject() {441 ref x => format!("{}", externs.id_to_str(x.id()))442 });If you're trying to ref/deref something, you can just use the
*or&operators, similar to C/C++. So I think each of these matches should just be:externs.id_to_str(*entry.node.product())Also, you shouldn't need the second
format!call in here, since the result is already a string.
I think I'd had some issues with
strvsStringin here. Not necessary. Thanks for calling it out.
On November 18th, 2016, 2:47 p.m. MST, Stu Hood wrote:
src/rust/engine/src/graph.rs (Diff revision 1) 444 format!("{}\n{} {}", output, indent, match entry.state {445 Some(Complete::Return(ref x)) => format!("Return({})", externs.val_to_str(x)),446 Some(Complete::Throw(ref x)) => format!("Throw({:?})", x),447 Some(Complete::Noop(ref x, ref opt_node)) => format!("Noop({:?}, {:?})", x, opt_node),448 None => String::new(),449 })Not a fan of the inline match like this, as opposed to breaking it out and naming it. But minor.
Broke it out.
On November 18th, 2016, 2:47 p.m. MST, Stu Hood wrote:
src/rust/engine/src/lib.rs (Diff revision 1) 459 let path_str = unsafe { CStr::from_ptr(path_ptr).to_string_lossy().into_owned() };460 let path = Path::new(path_str.as_str());461 with_scheduler(scheduler_ptr, |raw| {two-space indent
Got it.
- Nick
On November 18th, 2016, 1:56 p.m. MST, Nick Howard (Twitter) wrote:
|
Review request for pants-reviews, Benjy Weinberger, Kris Wilson, Stu Hood, and Yujie Chen.
By Nick Howard (Twitter).
|
Updated Nov. 18, 2016, 1:56 p.m. |
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4392/ |
|
Review request for pants-reviews, Benjy Weinberger, Kris Wilson, Stu Hood, and Yujie Chen.
By Nick Howard (Twitter).
|
Updated Nov. 18, 2016, 4:08 p.m. Changes
|
Diffs (updated)
|
|
|
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4392/ |
|
Review request for pants-reviews, Benjy Weinberger, Kris Wilson, Stu Hood, and Yujie Chen.
By Nick Howard (Twitter).
|
Updated Nov. 18, 2016, 5:10 p.m. Changes
|
|
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4392/ |
On November 18th, 2016, 5:15 p.m. MST, Kris Wilson wrote:
src/rust/engine/src/lib.rs (Diff revision 2) 463 println!("Failed to write trace to {}: {:?}", path.display(), e);probably fine for the moment, but I suspect raw
println's from the native side won't be daemon-safe due to the way the pailgun works (they'll likely end up in the daemons stdout which goes topantsd.log).we can circle back to this independently tho.
I had that thought too, but felt it was better to follow an existing pattern to be cleaned up later, than to do something different that might be hard to grep for later.
- Nick
On November 18th, 2016, 5:10 p.m. MST, Nick Howard (Twitter) wrote:
|
Review request for pants-reviews, Benjy Weinberger, Kris Wilson, Stu Hood, and Yujie Chen.
By Nick Howard (Twitter).
Updated Nov. 18, 2016, 5:10 p.m. |
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4392/ |
On November 19th, 2016, 12:15 a.m. UTC, Kris Wilson wrote:
src/rust/engine/src/lib.rs (Diff revision 2) 463 println!("Failed to write trace to {}: {:?}", path.display(), e);probably fine for the moment, but I suspect raw
println's from the native side won't be daemon-safe due to the way the pailgun works (they'll likely end up in the daemons stdout which goes topantsd.log).we can circle back to this independently tho.
On November 19th, 2016, 12:23 a.m. UTC, Nick Howard (Twitter) wrote:
I had that thought too, but felt it was better to follow an existing pattern to be cleaned up later, than to do something different that might be hard to grep for later.
+1... I'll look at this when I figure out the exception issue.
- Stu
On November 19th, 2016, 12:10 a.m. UTC, Nick Howard (Twitter) wrote:
|
Review request for pants-reviews, Benjy Weinberger, Kris Wilson, Stu Hood, and Yujie Chen.
By Nick Howard (Twitter).
|
Updated Nov. 19, 2016, 12:10 a.m. |
| This is an automatically generated e-mail. To reply, visit: https://rbcommons.com/s/twitter/r/4392/ |
Ship it!
Ship It!
- Stu Hood
On November 19th, 2016, 12:10 a.m. UTC, Nick Howard (Twitter) wrote:
|
Review request for pants-reviews, Benjy Weinberger, Kris Wilson, Stu Hood, and Yujie Chen.
By Nick Howard (Twitter).
|