Bug 1333531 - chunkify.chunkify breaks if less locales are in all-locales than chunks in decision task. r=aki
MozReview-Commit-ID: Hr7KgyHIMlc
--- a/taskcluster/taskgraph/transforms/l10n.py
+++ b/taskcluster/taskgraph/transforms/l10n.py
@@ -243,16 +243,19 @@ def all_locales_attribute(config, jobs):
@transforms.add
def chunk_locales(config, jobs):
""" Utilizes chunking for l10n stuff """
for job in jobs:
chunks = job.get('chunks')
all_locales = job['attributes']['all_locales']
if chunks:
+ if chunks > len(all_locales):
+ # Reduce chunks down to the number of locales
+ chunks = len(all_locales)
for this_chunk in range(1, chunks + 1):
chunked = copy.deepcopy(job)
chunked['name'] = chunked['name'].replace(
'/', '-{}/'.format(this_chunk), 1
)
chunked['mozharness']['options'] = chunked['mozharness'].get('options', [])
my_locales = []
my_locales = chunkify(all_locales, this_chunk, chunks)