Bug 1638990: [taskgraph] Store task ids as text, rather than bytes; r=ahal
authorTom Prince <mozilla@hocat.ca>
Mon, 20 Jul 2020 19:27:44 +0000
changeset 541335 625d545ca409fb29de49444b601a812120471f7f
parent 541334 6330322fb7f8a1cd9e306bc7188fb03d4ba1a0ae
child 541336 7b1128e12c72259d52316b8a0ef2d27264079da0
push id122172
push usermozilla@hocat.ca
push dateMon, 20 Jul 2020 20:16:13 +0000
treeherderautoland@7b1128e12c72 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1638990
milestone80.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1638990: [taskgraph] Store task ids as text, rather than bytes; r=ahal Differential Revision: https://phabricator.services.mozilla.com/D84085
taskcluster/taskgraph/morph.py
taskcluster/taskgraph/optimize/__init__.py
taskcluster/taskgraph/test/test_optimize.py
--- a/taskcluster/taskgraph/morph.py
+++ b/taskcluster/taskgraph/morph.py
@@ -96,17 +96,17 @@ def derive_misc_task(task, purpose, imag
     # taskgraph (has not been optimized).  It is included in
     # task_def['dependencies'] unconditionally.
     dependencies = {'parent': task.task_id}
     if image_taskid in taskgraph.tasks:
         dependencies['docker-image'] = image_taskid
 
     task = Task(kind='misc', label=label, attributes={}, task=task_def,
                 dependencies=dependencies)
-    task.task_id = slugid()
+    task.task_id = slugid().decode('ascii')
     return task
 
 
 # these regular expressions capture route prefixes for which we have a star
 # scope, allowing them to be summarized.  Each should correspond to a star scope
 # in each Gecko `assume:repo:hg.mozilla.org/...` role.
 SCOPE_SUMMARY_REGEXPS = [
     re.compile(r'(index:insert-task:docker\.images\.v1\.[^.]*\.).*'),
--- a/taskcluster/taskgraph/optimize/__init__.py
+++ b/taskcluster/taskgraph/optimize/__init__.py
@@ -215,17 +215,17 @@ def get_subgraph(
     if bad_edges:
         probs = ', '.join('{} depends on {} as {} but it has been removed'.format(l, r, n)
                           for l, r, n in bad_edges)
         raise Exception("Optimization error: " + probs)
 
     # fill in label_to_taskid for anything not removed or replaced
     assert replaced_tasks <= set(label_to_taskid)
     for label in sorted(target_task_graph.graph.nodes - removed_tasks - set(label_to_taskid)):
-        label_to_taskid[label] = slugid()
+        label_to_taskid[label] = slugid().decode('ascii')
 
     # resolve labels to taskIds and populate task['dependencies']
     tasks_by_taskid = {}
     named_links_dict = target_task_graph.graph.named_links_dict()
     omit = removed_tasks | replaced_tasks
     for label, task in six.iteritems(target_task_graph.tasks):
         if label in omit:
             continue
--- a/taskcluster/taskgraph/test/test_optimize.py
+++ b/taskcluster/taskgraph/test/test_optimize.py
@@ -206,17 +206,17 @@ class TestOptimize(unittest.TestCase):
             graph,
             exp_replaced={'t1'},
             exp_removed={'t2', 't3'},
             exp_label_to_taskid={'t1': 'e1'})
 
     def assert_subgraph(self, graph, removed_tasks, replaced_tasks,
                         label_to_taskid, exp_subgraph, exp_label_to_taskid):
         self.maxDiff = None
-        optimize.slugid = partial(next, ('tid{}'.format(i) for i in range(1, 10)))
+        optimize.slugid = partial(next, (b'tid%d' % i for i in range(1, 10)))
         try:
             got_subgraph = optimize.get_subgraph(graph, removed_tasks,
                                                  replaced_tasks, label_to_taskid,
                                                  "DECISION-TASK")
         finally:
             optimize.slugid = slugid
         self.assertEqual(got_subgraph.graph, exp_subgraph.graph)
         self.assertEqual(got_subgraph.tasks, exp_subgraph.tasks)