Bug 1333531 - chunkify.chunkify breaks if less locales are in all-locales than chunks in decision task. r=aki draft
authorJustin Wood <Callek@gmail.com>
Fri, 27 Jan 2017 15:47:30 -0500
changeset 467481 f54b096d7885ccd05a0a4dbc1130dc76bb32755e
parent 467243 07d7ecbf77e3be59797f16234d357a02bb38ed8b
child 543686 e1e6f5d7822f22fc294c83452b5bb6bdfb028c6c
push id43175
push userCallek@gmail.com
push dateFri, 27 Jan 2017 20:48:00 +0000
reviewersaki
bugs1333531
milestone54.0a1
Bug 1333531 - chunkify.chunkify breaks if less locales are in all-locales than chunks in decision task. r=aki MozReview-Commit-ID: Hr7KgyHIMlc
taskcluster/taskgraph/transforms/l10n.py
--- 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)