Skip to content

Commit b723a93

Browse files
authored
DEVPROD-4926 add use_xlarge_distro option to mongo-task-generator (#71)
DEVPROD-4926 add use_xlarge_distro option to mongo-task-generator
1 parent 8a83bd4 commit b723a93

File tree

9 files changed

+46
-5
lines changed

9 files changed

+46
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 0.7.11 - 2024-02-16
4+
* DEVPROD-4926 add use_xlarge_distro option to mongo-task-generator
5+
36
## 0.7.10 - 2022-09-25
47
* SERVER-81436 Read multiversion config from file instead of resmoke output.
58

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mongo-task-generator"
33
description = "Dynamically split evergreen tasks into subtasks for testing the mongodb/mongo project."
44
license = "Apache-2.0"
5-
version = "0.7.10"
5+
version = "0.7.11"
66
repository = "https://github.com/mongodb/mongo-task-generator"
77
authors = ["Decision Automation Group <[email protected]>"]
88
edition = "2018"

docs/generating_tasks.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Looking at a [sample resmoke-based](https://github.com/mongodb/mongo/blob/852c5d
101101
```
102102

103103
Like fuzzer tasks, task generation is indicated by including the `"generate resmoke tasks"` function.
104-
Additionally, the 2 parameters here will impact how the task is generated.
104+
Additionally, the 3 parameters here will impact how the task is generated.
105105

106106
* **suite**: By default, the name of the task (with the `_gen` suffix stripped off) will be used
107107
to determine which resmoke suite to base the generated sub-tasks on. This can be overwritten with
@@ -110,6 +110,10 @@ Additionally, the 2 parameters here will impact how the task is generated.
110110
successfully. When generated sub-tasks are run on build_variants with a `large_distro_name`
111111
expansion defined, they will run on that large distro instead of the default distro by setting
112112
the `use_large_distro` variable to `"true"`.
113+
* **use_xlarge_distro**: For when `use_large_distro` is not enough. When the `use_xlarge_distro`
114+
variable is set to `"true"`, certain tasks will use an even larger distro that can be defined with
115+
the `xlarge_distro_name` expansion in the build variant. When the `xlarge_distro_name` expansion
116+
is not defined, it will fallback to the defined `large_distro_name` expansion in the build variant
113117

114118
**Note**: If a task has the `use_large_distro` value defined, but is added to a build variant
115119
without a `large_distro_name`, it will trigger a failure. This can be supported by using the

src/evergreen_names.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ pub const BURN_IN_TASKS: &str = "burn_in_tasks_gen";
5050
pub const IS_FUZZER: &str = "is_jstestfuzz";
5151
/// If true, generate sub-tasks to run on large distros.
5252
pub const USE_LARGE_DISTRO: &str = "use_large_distro";
53+
/// If true, generate sub-tasks to run on large distros.
54+
pub const USE_XLARGE_DISTRO: &str = "use_xlarge_distro";
5355
/// Number of files that each fuzzer sub-task should generate.
5456
pub const NUM_FUZZER_FILES: &str = "num_files";
5557
/// Number of sub-tasks that should be generated for a fuzzer.
@@ -93,6 +95,8 @@ pub const MULTIVERSION_EXCLUDE_TAGS: &str = "multiversion_exclude_tags_version";
9395
// Build Variant expansions.
9496
/// Name of large distro for build variant.
9597
pub const LARGE_DISTRO_EXPANSION: &str = "large_distro_name";
98+
/// Name of xlarge distro for build variant.
99+
pub const XLARGE_DISTRO_EXPANSION: &str = "xlarge_distro_name";
96100
/// List of build variant names delimited by spaces to generate burn_in_tests for.
97101
pub const BURN_IN_TAG_INCLUDE_BUILD_VARIANTS: &str = "burn_in_tag_include_build_variants";
98102
/// Generate burn_in_tests for all required and suggested build variants.

src/services/config_extraction.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::{
99
CONTINUE_ON_FAILURE, FUZZER_PARAMETERS, IDLE_TIMEOUT, LARGE_DISTRO_EXPANSION, MULTIVERSION,
1010
NO_MULTIVERSION_GENERATE_TASKS, NPM_COMMAND, NUM_FUZZER_FILES, NUM_FUZZER_TASKS,
1111
REPEAT_SUITES, RESMOKE_ARGS, RESMOKE_JOBS_MAX, SHOULD_SHUFFLE_TESTS, USE_LARGE_DISTRO,
12+
USE_XLARGE_DISTRO, XLARGE_DISTRO_EXPANSION,
1213
},
1314
generate_sub_tasks_config::GenerateSubTasksConfig,
1415
task_types::{
@@ -235,6 +236,11 @@ impl ConfigExtractionService for ConfigExtractionServiceImpl {
235236
USE_LARGE_DISTRO,
236237
false,
237238
)?,
239+
use_xlarge_distro: self.evg_config_utils.lookup_default_param_bool(
240+
task_def,
241+
USE_XLARGE_DISTRO,
242+
false,
243+
)?,
238244
require_multiversion_setup,
239245
require_multiversion_generate_tasks: require_multiversion_setup
240246
&& !no_multiversion_generate_tasks,
@@ -286,9 +292,16 @@ impl ConfigExtractionService for ConfigExtractionServiceImpl {
286292
let large_distro_name = self
287293
.evg_config_utils
288294
.lookup_build_variant_expansion(LARGE_DISTRO_EXPANSION, build_variant);
295+
let xlarge_distro_name = self
296+
.evg_config_utils
297+
.lookup_build_variant_expansion(XLARGE_DISTRO_EXPANSION, build_variant);
289298
let build_variant_name = build_variant.name.as_str();
290299

291-
if generated_task.use_large_distro() {
300+
if generated_task.use_xlarge_distro() && xlarge_distro_name.is_some() {
301+
return Ok(xlarge_distro_name);
302+
}
303+
304+
if generated_task.use_large_distro() || generated_task.use_xlarge_distro() {
292305
if large_distro_name.is_some() {
293306
return Ok(large_distro_name);
294307
}
@@ -414,6 +427,7 @@ mod tests {
414427
..Default::default()
415428
},
416429
use_large_distro: *value,
430+
use_xlarge_distro: false,
417431
})
418432
.collect(),
419433
};
@@ -444,6 +458,7 @@ mod tests {
444458
..Default::default()
445459
},
446460
use_large_distro: true,
461+
use_xlarge_distro: false,
447462
}],
448463
};
449464
let build_variant = BuildVariant {
@@ -474,6 +489,7 @@ mod tests {
474489
..Default::default()
475490
},
476491
use_large_distro: true,
492+
use_xlarge_distro: false,
477493
}],
478494
};
479495
let build_variant = BuildVariant {

src/task_types/fuzzer_tasks.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ impl GeneratedSuite for FuzzerTask {
168168
.map(|sub_task| GeneratedSubTask {
169169
evg_task: sub_task,
170170
use_large_distro: false,
171+
use_xlarge_distro: false,
171172
})
172173
.collect()
173174
}

src/task_types/generated_suite.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ pub struct GeneratedSubTask {
1010
pub evg_task: EvgTask,
1111
/// Whether to run generated task on a large distro.
1212
pub use_large_distro: bool,
13+
/// Whether to run generated task on a xlarge distro.
14+
pub use_xlarge_distro: bool,
1315
}
1416

1517
/// Interface for representing a generated task.
@@ -27,6 +29,13 @@ pub trait GeneratedSuite: Sync + Send {
2729
.any(|sub_task| sub_task.use_large_distro)
2830
}
2931

32+
/// Check whether any sub task requires xlarge distro.
33+
fn use_xlarge_distro(&self) -> bool {
34+
self.sub_tasks()
35+
.iter()
36+
.any(|sub_task| sub_task.use_xlarge_distro)
37+
}
38+
3039
/// Build a shrub display task for this generated task.
3140
fn build_display_task(&self) -> DisplayTask {
3241
DisplayTask {
@@ -45,7 +54,7 @@ pub trait GeneratedSuite: Sync + Send {
4554
.iter()
4655
.map(|sub_task| {
4756
let mut large_distro = None;
48-
if sub_task.use_large_distro {
57+
if sub_task.use_large_distro || sub_task.use_xlarge_distro {
4958
large_distro = distro.clone();
5059
}
5160
sub_task

src/task_types/resmoke_tasks.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ pub struct ResmokeGenParams {
5252
pub suite_name: String,
5353
/// Should the generated tasks run on a 'large' distro.
5454
pub use_large_distro: bool,
55+
/// Should the generated tasks run on a 'xlarge' distro.
56+
pub use_xlarge_distro: bool,
5557
/// Does this task require multiversion setup.
5658
pub require_multiversion_setup: bool,
5759
/// Should multiversion generate tasks exist for this.
@@ -776,6 +778,7 @@ impl GenResmokeTaskService for GenResmokeTaskServiceImpl {
776778
..Default::default()
777779
},
778780
use_large_distro: params.use_large_distro,
781+
use_xlarge_distro: params.use_xlarge_distro,
779782
}
780783
}
781784
}
@@ -1014,6 +1017,7 @@ mod tests {
10141017
..Default::default()
10151018
},
10161019
use_large_distro: *value,
1020+
use_xlarge_distro: false,
10171021
})
10181022
.collect(),
10191023
};

0 commit comments

Comments
 (0)