Skip to content

Commit eddf495

Browse files
authored
Move batchtime from task definitions to task refs (#1768)
1 parent a1c99c4 commit eddf495

File tree

5 files changed

+187
-45
lines changed

5 files changed

+187
-45
lines changed

.evergreen/config_generator/components/cse/openssl.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from shrub.v3.evg_build_variant import BuildVariant
2-
from shrub.v3.evg_task import EvgTaskRef
32

43
from config_generator.etc.compile import generate_compile_tasks
54
from config_generator.etc.function import merge_defns
5+
from config_generator.etc.utils import TaskRef
66

77
from config_generator.etc.cse.compile import CompileCommon
88
from config_generator.etc.cse.test import generate_test_tasks
@@ -64,23 +64,25 @@ def functions():
6464
)
6565

6666

67-
def tasks():
68-
res = []
67+
SASL_TO_FUNC = {
68+
'cyrus': SaslCyrusOpenSSLCompile,
69+
}
6970

70-
SASL_TO_FUNC = {
71-
'cyrus': SaslCyrusOpenSSLCompile,
72-
}
71+
MORE_TAGS = ['cse']
7372

74-
MORE_TAGS = ['cse']
73+
TASKS = [
74+
*generate_compile_tasks(SSL, TAG, SASL_TO_FUNC, COMPILE_MATRIX, MORE_TAGS),
75+
*generate_test_tasks(SSL, TAG, TEST_MATRIX),
76+
]
7577

76-
res += generate_compile_tasks(SSL, TAG, SASL_TO_FUNC, COMPILE_MATRIX, MORE_TAGS)
77-
res += generate_test_tasks(SSL, TAG, TEST_MATRIX)
78+
79+
def tasks():
80+
res = TASKS.copy()
7881

7982
# PowerPC and zSeries are limited resources.
8083
for task in res:
8184
if any(pattern in task.run_on for pattern in ["power8", "zseries"]):
8285
task.patchable = False
83-
task.batchtime = 1440 # 1 day
8486

8587
return res
8688

@@ -90,11 +92,25 @@ def variants():
9092
'CLIENT_SIDE_ENCRYPTION': 'on',
9193
}
9294

95+
tasks = []
96+
97+
# PowerPC and zSeries are limited resources.
98+
for task in TASKS:
99+
if any(pattern in task.run_on for pattern in ["power8", "zseries"]):
100+
tasks.append(
101+
TaskRef(
102+
name=task.name,
103+
batchtime=1440, # 1 day
104+
)
105+
)
106+
else:
107+
tasks.append(task.get_task_ref())
108+
93109
return [
94110
BuildVariant(
95111
name=TAG,
96112
display_name=TAG,
97-
tasks=[EvgTaskRef(name=f'.{TAG}')],
113+
tasks=tasks,
98114
expansions=expansions,
99115
),
100116
]

.evergreen/config_generator/components/sasl/openssl.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
from typing import List
2+
13
from shrub.v3.evg_build_variant import BuildVariant
2-
from shrub.v3.evg_task import EvgTaskRef
34

5+
from config_generator.etc.utils import TaskRef
46
from config_generator.etc.function import merge_defns
57
from config_generator.etc.compile import generate_compile_tasks
68

@@ -67,33 +69,49 @@ def functions():
6769
)
6870

6971

70-
def tasks():
71-
res = []
72+
SASL_TO_FUNC = {
73+
'cyrus': SaslCyrusOpenSSLCompile,
74+
}
7275

73-
SASL_TO_FUNC = {
74-
'cyrus': SaslCyrusOpenSSLCompile,
75-
}
76+
TASKS = [
77+
*generate_compile_tasks(SSL, TAG, SASL_TO_FUNC, COMPILE_MATRIX),
78+
*generate_test_tasks(SSL, TAG, TEST_MATRIX),
79+
]
7680

77-
res += generate_compile_tasks(SSL, TAG, SASL_TO_FUNC, COMPILE_MATRIX)
78-
res += generate_test_tasks(SSL, TAG, TEST_MATRIX)
81+
82+
def tasks():
83+
res = TASKS.copy()
7984

8085
# PowerPC and zSeries are limited resources.
8186
for task in res:
8287
if any(pattern in task.run_on for pattern in ["power8", "zseries"]):
8388
task.patchable = False
84-
task.batchtime = 1440 # 1 day
8589

8690
return res
8791

8892

8993
def variants():
9094
expansions = {}
9195

96+
tasks = []
97+
98+
# PowerPC and zSeries are limited resources.
99+
for task in TASKS:
100+
if any(pattern in task.run_on for pattern in ["power8", "zseries"]):
101+
tasks.append(
102+
TaskRef(
103+
name=task.name,
104+
batchtime=1440, # 1 day
105+
)
106+
)
107+
else:
108+
tasks.append(task.get_task_ref())
109+
92110
return [
93111
BuildVariant(
94112
name=TAG,
95113
display_name=TAG,
96-
tasks=[EvgTaskRef(name=f'.{TAG}')],
114+
tasks=tasks,
97115
expansions=expansions,
98116
),
99117
]

.evergreen/config_generator/etc/utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,23 @@
1010
from shrub.v3.evg_command import EvgCommandType, subprocess_exec
1111
from shrub.v3.evg_project import EvgProject
1212
from shrub.v3.shrub_service import ConfigDumper
13+
from shrub.v3.evg_task import EvgTaskRef
1314
from typing_extensions import get_args, get_origin, get_type_hints
1415

1516
T = TypeVar('T')
1617

1718

19+
# Equivalent to EvgTaskRef but defines additional properties.
20+
class TaskRef(EvgTaskRef):
21+
"""
22+
An evergreen task reference model that also includes additional properties.
23+
24+
(The shrub.py model is missing some properties)
25+
"""
26+
27+
batchtime: int | None = None
28+
29+
1830
# Automatically formats the provided script and invokes it in Bash.
1931
def bash_exec(
2032
script,

.evergreen/generated_configs/tasks.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,6 @@ tasks:
16051605
- name: cse-sasl-cyrus-openssl-rhel83-zseries-gcc-compile
16061606
run_on: rhel83-zseries-large
16071607
tags: [cse-matrix-openssl, compile, rhel83-zseries, gcc, cse, sasl-cyrus]
1608-
batchtime: 1440
16091608
patchable: false
16101609
commands:
16111610
- func: find-cmake-latest
@@ -1617,7 +1616,6 @@ tasks:
16171616
run_on: rhel83-zseries-small
16181617
tags: [cse-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, cse, auth, server, "5.0", openssl]
16191618
depends_on: [{ name: cse-sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
1620-
batchtime: 1440
16211619
patchable: false
16221620
commands:
16231621
- func: fetch-build
@@ -1639,7 +1637,6 @@ tasks:
16391637
run_on: rhel83-zseries-small
16401638
tags: [cse-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, cse, auth, replica, "7.0", openssl]
16411639
depends_on: [{ name: cse-sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
1642-
batchtime: 1440
16431640
patchable: false
16441641
commands:
16451642
- func: fetch-build
@@ -1661,7 +1658,6 @@ tasks:
16611658
run_on: rhel83-zseries-small
16621659
tags: [cse-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, cse, auth, server, "7.0", openssl]
16631660
depends_on: [{ name: cse-sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
1664-
batchtime: 1440
16651661
patchable: false
16661662
commands:
16671663
- func: fetch-build
@@ -1683,7 +1679,6 @@ tasks:
16831679
run_on: rhel83-zseries-small
16841680
tags: [cse-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, cse, auth, replica, "8.0", openssl]
16851681
depends_on: [{ name: cse-sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
1686-
batchtime: 1440
16871682
patchable: false
16881683
commands:
16891684
- func: fetch-build
@@ -1705,7 +1700,6 @@ tasks:
17051700
run_on: rhel83-zseries-small
17061701
tags: [cse-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, cse, auth, server, "8.0", openssl]
17071702
depends_on: [{ name: cse-sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
1708-
batchtime: 1440
17091703
patchable: false
17101704
commands:
17111705
- func: fetch-build
@@ -1727,7 +1721,6 @@ tasks:
17271721
run_on: rhel83-zseries-small
17281722
tags: [cse-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, cse, auth, replica, latest, openssl]
17291723
depends_on: [{ name: cse-sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
1730-
batchtime: 1440
17311724
patchable: false
17321725
commands:
17331726
- func: fetch-build
@@ -1749,7 +1742,6 @@ tasks:
17491742
run_on: rhel83-zseries-small
17501743
tags: [cse-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, cse, auth, server, latest, openssl]
17511744
depends_on: [{ name: cse-sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
1752-
batchtime: 1440
17531745
patchable: false
17541746
commands:
17551747
- func: fetch-build
@@ -3217,7 +3209,6 @@ tasks:
32173209
- name: sasl-cyrus-openssl-rhel81-power8-gcc-compile
32183210
run_on: rhel81-power8-large
32193211
tags: [sasl-matrix-openssl, compile, rhel81-power8, gcc, sasl-cyrus]
3220-
batchtime: 1440
32213212
patchable: false
32223213
commands:
32233214
- func: find-cmake-latest
@@ -3229,7 +3220,6 @@ tasks:
32293220
run_on: rhel81-power8-small
32303221
tags: [sasl-matrix-openssl, test, rhel81-power8, gcc, sasl-cyrus, auth, server, "4.2", openssl]
32313222
depends_on: [{ name: sasl-cyrus-openssl-rhel81-power8-gcc-compile }]
3232-
batchtime: 1440
32333223
patchable: false
32343224
commands:
32353225
- func: fetch-build
@@ -3251,7 +3241,6 @@ tasks:
32513241
run_on: rhel81-power8-small
32523242
tags: [sasl-matrix-openssl, test, rhel81-power8, gcc, sasl-cyrus, auth, server, "4.4", openssl]
32533243
depends_on: [{ name: sasl-cyrus-openssl-rhel81-power8-gcc-compile }]
3254-
batchtime: 1440
32553244
patchable: false
32563245
commands:
32573246
- func: fetch-build
@@ -3273,7 +3262,6 @@ tasks:
32733262
run_on: rhel81-power8-small
32743263
tags: [sasl-matrix-openssl, test, rhel81-power8, gcc, sasl-cyrus, auth, server, "5.0", openssl]
32753264
depends_on: [{ name: sasl-cyrus-openssl-rhel81-power8-gcc-compile }]
3276-
batchtime: 1440
32773265
patchable: false
32783266
commands:
32793267
- func: fetch-build
@@ -3295,7 +3283,6 @@ tasks:
32953283
run_on: rhel81-power8-small
32963284
tags: [sasl-matrix-openssl, test, rhel81-power8, gcc, sasl-cyrus, auth, server, "6.0", openssl]
32973285
depends_on: [{ name: sasl-cyrus-openssl-rhel81-power8-gcc-compile }]
3298-
batchtime: 1440
32993286
patchable: false
33003287
commands:
33013288
- func: fetch-build
@@ -3317,7 +3304,6 @@ tasks:
33173304
run_on: rhel81-power8-small
33183305
tags: [sasl-matrix-openssl, test, rhel81-power8, gcc, sasl-cyrus, auth, server, "7.0", openssl]
33193306
depends_on: [{ name: sasl-cyrus-openssl-rhel81-power8-gcc-compile }]
3320-
batchtime: 1440
33213307
patchable: false
33223308
commands:
33233309
- func: fetch-build
@@ -3339,7 +3325,6 @@ tasks:
33393325
run_on: rhel81-power8-small
33403326
tags: [sasl-matrix-openssl, test, rhel81-power8, gcc, sasl-cyrus, auth, server, "8.0", openssl]
33413327
depends_on: [{ name: sasl-cyrus-openssl-rhel81-power8-gcc-compile }]
3342-
batchtime: 1440
33433328
patchable: false
33443329
commands:
33453330
- func: fetch-build
@@ -3361,7 +3346,6 @@ tasks:
33613346
run_on: rhel81-power8-small
33623347
tags: [sasl-matrix-openssl, test, rhel81-power8, gcc, sasl-cyrus, auth, server, latest, openssl]
33633348
depends_on: [{ name: sasl-cyrus-openssl-rhel81-power8-gcc-compile }]
3364-
batchtime: 1440
33653349
patchable: false
33663350
commands:
33673351
- func: fetch-build
@@ -3382,7 +3366,6 @@ tasks:
33823366
- name: sasl-cyrus-openssl-rhel83-zseries-gcc-compile
33833367
run_on: rhel83-zseries-large
33843368
tags: [sasl-matrix-openssl, compile, rhel83-zseries, gcc, sasl-cyrus]
3385-
batchtime: 1440
33863369
patchable: false
33873370
commands:
33883371
- func: find-cmake-latest
@@ -3394,7 +3377,6 @@ tasks:
33943377
run_on: rhel83-zseries-small
33953378
tags: [sasl-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, auth, server, "5.0", openssl]
33963379
depends_on: [{ name: sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
3397-
batchtime: 1440
33983380
patchable: false
33993381
commands:
34003382
- func: fetch-build
@@ -3416,7 +3398,6 @@ tasks:
34163398
run_on: rhel83-zseries-small
34173399
tags: [sasl-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, auth, server, "6.0", openssl]
34183400
depends_on: [{ name: sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
3419-
batchtime: 1440
34203401
patchable: false
34213402
commands:
34223403
- func: fetch-build
@@ -3438,7 +3419,6 @@ tasks:
34383419
run_on: rhel83-zseries-small
34393420
tags: [sasl-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, auth, server, "7.0", openssl]
34403421
depends_on: [{ name: sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
3441-
batchtime: 1440
34423422
patchable: false
34433423
commands:
34443424
- func: fetch-build
@@ -3460,7 +3440,6 @@ tasks:
34603440
run_on: rhel83-zseries-small
34613441
tags: [sasl-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, auth, server, "8.0", openssl]
34623442
depends_on: [{ name: sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
3463-
batchtime: 1440
34643443
patchable: false
34653444
commands:
34663445
- func: fetch-build
@@ -3482,7 +3461,6 @@ tasks:
34823461
run_on: rhel83-zseries-small
34833462
tags: [sasl-matrix-openssl, test, rhel83-zseries, gcc, sasl-cyrus, auth, server, latest, openssl]
34843463
depends_on: [{ name: sasl-cyrus-openssl-rhel83-zseries-gcc-compile }]
3485-
batchtime: 1440
34863464
patchable: false
34873465
commands:
34883466
- func: fetch-build

0 commit comments

Comments
 (0)