Skip to content

Commit 5192a8c

Browse files
authored
DEVPROD-16911 make number of sub-tasks configurable (#94)
1 parent 965a6ce commit 5192a8c

File tree

8 files changed

+96
-60
lines changed

8 files changed

+96
-60
lines changed

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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
name = "mongo-task-generator"
33
description = "Dynamically split evergreen tasks into subtasks for testing the 10gen/mongo project."
44
license = "Apache-2.0"
5-
version = "1.0.0"
5+
version = "1.1.0"
66
repository = "https://github.com/mongodb/mongo-task-generator"
77
authors = ["DevProd Correctness Team <[email protected]>"]
88
edition = "2018"
9+
rust-version = "1.75"
910

1011
[dependencies]
1112
anyhow = "1.0.86"

docs/generating_tasks.md

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

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

104104
* **suite**: By default, the name of the task (with the `_gen` suffix stripped off) will be used
105105
to determine which resmoke suite to base the generated sub-tasks on. This can be overwritten with
@@ -112,6 +112,7 @@ Additionally, the 3 parameters here will impact how the task is generated.
112112
variable is set to `"true"`, certain tasks will use an even larger distro that can be defined with
113113
the `xlarge_distro_name` expansion in the build variant. When the `xlarge_distro_name` expansion
114114
is not defined, it will fallback to the defined `large_distro_name` expansion in the build variant
115+
* **num_tasks**: The number of generated sub-tasks to split into. (Default 5).
115116

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

src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ mod utils;
5858
const BURN_IN_TESTS_PREFIX: &str = "burn_in_tests";
5959
const BURN_IN_TASKS_PREFIX: &str = "burn_in_tasks";
6060
const BURN_IN_BV_SUFFIX: &str = "generated-by-burn-in-tags";
61-
const MAX_SUB_TASKS_PER_TASK: usize = 5;
61+
const DEFAULT_SUB_TASKS_PER_TASK: usize = 5;
6262

6363
type GenTaskCollection = HashMap<String, Box<dyn GeneratedSuite>>;
6464

@@ -206,11 +206,8 @@ impl Dependencies {
206206
32,
207207
)));
208208
let enterprise_dir = evg_config_service.get_module_dir(ENTERPRISE_MODULE);
209-
let gen_resmoke_config = GenResmokeConfig::new(
210-
MAX_SUB_TASKS_PER_TASK,
211-
execution_config.use_task_split_fallback,
212-
enterprise_dir,
213-
);
209+
let gen_resmoke_config =
210+
GenResmokeConfig::new(execution_config.use_task_split_fallback, enterprise_dir);
214211
let gen_resmoke_task_service = Arc::new(GenResmokeTaskServiceImpl::new(
215212
task_history_service,
216213
discovery_service,

src/services/config_extraction.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use crate::{
1818
multiversion::MultiversionService, resmoke_tasks::ResmokeGenParams,
1919
},
2020
utils::task_name::remove_gen_suffix,
21+
DEFAULT_SUB_TASKS_PER_TASK,
2122
};
2223

2324
/// Interface for performing extractions of evergreen project configuration.
@@ -248,6 +249,13 @@ impl ConfigExtractionService for ConfigExtractionServiceImpl {
248249
.evg_config_utils
249250
.lookup_build_variant_expansion(UNIQUE_GEN_SUFFIX_EXPANSION, variant);
250251
}
252+
let num_tasks = match self
253+
.evg_config_utils
254+
.get_gen_task_var(task_def, "num_tasks")
255+
{
256+
Some(str) => str.parse().unwrap(),
257+
_ => DEFAULT_SUB_TASKS_PER_TASK,
258+
};
251259

252260
Ok(ResmokeGenParams {
253261
task_name,
@@ -289,6 +297,7 @@ impl ConfigExtractionService for ConfigExtractionServiceImpl {
289297
pass_through_vars: self.evg_config_utils.get_gen_task_vars(task_def),
290298
platform,
291299
gen_task_suffix,
300+
num_tasks,
292301
})
293302
}
294303

0 commit comments

Comments
 (0)