mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1633866 - [taskgraph] Truncate runtimes that exceed DYNAMIC_CHUNK_DURATION so they don't artificially increase chunks, r=gbrown
For example, assume we have three manifests: foo -> 98 minutes bar -> 1 minute baz -> 1 minute And let's say we want average chunk lengths of ~20 minutes. The calculation would currently say we need 5 chunks ((98 + 1 + 1) / 20). Even if set the max chunks to the # of manifests, it would still return 3. Clearly this only needs at most 2 chunks to run. By truncating the runtime, we'd have: foo -> 20 minutes (truncated) bar -> 1 minute baz -> 1 minute So we'd actually only assign one chunk (round((20 + 1 + 1) / 20)). Despite having a single 100 minute chunk, this outcome is desirable as we now avoid the overhead of a second chunk that only runs 2 minutes worth of tests. Depends on D77871 Differential Revision: https://phabricator.services.mozilla.com/D77873
This commit is contained in:
parent
b3fbd0cf70
commit
d4001d553e
@ -1442,7 +1442,10 @@ def resolve_dynamic_chunks(config, tasks):
|
||||
runtimes = {m: r for m, r in get_runtimes(task['test-platform'], task['suite']).items()
|
||||
if m in task['test-manifests']['active']}
|
||||
|
||||
times = list(runtimes.values())
|
||||
# Truncate runtimes that are above the desired chunk duration. They
|
||||
# will be assigned to a chunk on their own and the excess duration
|
||||
# shouldn't cause additional chunks to be needed.
|
||||
times = [min(DYNAMIC_CHUNK_DURATION, r) for r in runtimes.values()]
|
||||
avg = round(sum(times) / len(times), 2) if times else 0
|
||||
total = sum(times)
|
||||
|
||||
@ -1451,7 +1454,11 @@ def resolve_dynamic_chunks(config, tasks):
|
||||
missing = [m for m in task['test-manifests']['active'] if m not in runtimes]
|
||||
total += avg * len(missing)
|
||||
|
||||
task['chunks'] = int(round(total / DYNAMIC_CHUNK_DURATION)) or 1
|
||||
chunks = int(round(total / DYNAMIC_CHUNK_DURATION))
|
||||
|
||||
# Make sure we never exceed the number of manifests, nor have a chunk
|
||||
# length of 0.
|
||||
task['chunks'] = min(chunks, len(task['test-manifests']['active'])) or 1
|
||||
yield task
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user