-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add --partition M/N to distribute builds #253
Changes from 1 commit
1340194
83f8579
7e09f89
e31c00c
f66a53b
03cf795
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -639,6 +639,22 @@ impl FromStr for LogGroup { | |
} | ||
} | ||
|
||
pub(crate) struct Partition { | ||
index: usize, | ||
count: usize, | ||
} | ||
|
||
impl FromStr for Partition { | ||
type Err = Error; | ||
|
||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { | ||
match s.split('/').map(str::parse::<usize>).collect::<Vec<_>>()[..] { | ||
[Ok(index), Ok(count)] if 0 < index && index <= count => Ok(Self { index, count }), | ||
_ => bail!("bad or out-of-range partition: {s}"), | ||
} | ||
} | ||
} | ||
|
||
fn exec_cargo( | ||
cx: &Context, | ||
id: &PackageId, | ||
|
@@ -672,7 +688,26 @@ fn exec_cargo_inner( | |
if progress.count != 0 && !cx.print_command_list && cx.log_group == LogGroup::None { | ||
eprintln!(); | ||
} | ||
progress.count += 1; | ||
|
||
let new_count = progress.count + 1; | ||
let mut skip = false; | ||
if let Some(partition) = &cx.partition { | ||
if progress.count % partition.count != partition.index - 1 { | ||
let mut msg = String::new(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC this would be something like:
I think this is fine for the nextest use, I guess it maybe a bit inefficient for cargo-hack use, since the feature combinations that would reduce the amount of recompilation are often before or after the current combination. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for nice suggestion. I've switched from interleaved partitioning to chunked partitioning. and seems our ci got quicker to finish: https://buildkite.com/anza/agave/builds/7952#0190d3f9-52af-4b75-9e69-e408f4a1a57e |
||
if term::verbose() { | ||
write!(msg, "skipping {line}").unwrap(); | ||
} else { | ||
write!(msg, "skipping {line} on {}", cx.packages(id).name).unwrap(); | ||
} | ||
write!(msg, " ({}/{})", new_count, progress.total).unwrap(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this may be subjective, but i liked explicitly printing messages about being skipped. |
||
let _guard = cx.log_group.print(&msg); | ||
skip = true; | ||
} | ||
} | ||
progress.count = new_count; | ||
if skip { | ||
return Ok(()); | ||
} | ||
|
||
if cx.clean_per_run { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (unrelated to this pr: i don't think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. Well, both are optional and I don't know what the use case of using --clean-per-run together with -pr-int-command-list in the first place, though... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for quick reply. I'll create a small pr after this pr to fix this. |
||
cargo_clean(cx, Some(id))?; | ||
|
@@ -690,7 +725,7 @@ fn exec_cargo_inner( | |
} else { | ||
write!(msg, "running {line} on {}", cx.packages(id).name).unwrap(); | ||
} | ||
write!(msg, " ({}/{})", progress.count, progress.total).unwrap(); | ||
write!(msg, " ({}/{})", new_count, progress.total).unwrap(); | ||
let _guard = cx.log_group.print(&msg); | ||
|
||
line.run() | ||
|
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.
this again subjective as well. but it's more intuitive not to see adjusted progress (i.e.
{X/N}/{Y/N}
) after partitioning while showing the skip messages.