Bug 1414924 - test-action-callback prints task definitions scrambled r=dustin draft
authorRail Aliiev <rail@mozilla.com>
Mon, 06 Nov 2017 16:29:35 -0500
changeset 693795 2beb402ee8b5d9ad181df729e062ad3572b753f8
parent 693680 911d141f1cb18453a3fd4a1c5b311214ea61d3e6
child 739139 95f565b8e6cbfeac8ae98793e5bb4cb8865ed5fc
push id87919
push userbmo:rail@mozilla.com
push dateMon, 06 Nov 2017 21:30:26 +0000
reviewersdustin
bugs1414924
milestone58.0a1
Bug 1414924 - test-action-callback prints task definitions scrambled r=dustin MozReview-Commit-ID: GiJsOiTVUXL
taskcluster/taskgraph/create.py
--- a/taskcluster/taskgraph/create.py
+++ b/taskcluster/taskgraph/create.py
@@ -59,17 +59,19 @@ def create_tasks(taskgraph, label_to_tas
         # loop fails halfway through, none of the already-created tasks run.
         if decision_task_id:
             if not any(t in taskgraph.tasks for t in task_def.get('dependencies', [])):
                 task_def.setdefault('dependencies', []).append(decision_task_id)
 
         task_def['taskGroupId'] = task_group_id
         task_def['schedulerId'] = scheduler_id
 
-    with futures.ThreadPoolExecutor(CONCURRENCY) as e:
+    # If `testing` is True, then run without parallelization
+    concurrency = CONCURRENCY if not testing else 1
+    with futures.ThreadPoolExecutor(concurrency) as e:
         fs = {}
 
         # We can't submit a task until its dependencies have been submitted.
         # So our strategy is to walk the graph and submit tasks once all
         # their dependencies have been submitted.
         tasklist = set(taskgraph.graph.visit_postorder())
         alltasks = tasklist.copy()
 
@@ -124,16 +126,18 @@ def create_task(session, task_id, label,
 
     # Resolve timestamps
     now = current_json_time(datetime_format=True)
     task_def = resolve_timestamps(now, task_def)
 
     if testing:
         json.dump([task_id, task_def], sys.stdout,
                   sort_keys=True, indent=4, separators=(',', ': '))
+        # add a newline
+        print("")
         return
 
     logger.debug("Creating task with taskId {} for {}".format(task_id, label))
     res = session.put('http://taskcluster/queue/v1/task/{}'.format(task_id),
                       data=json.dumps(task_def))
     if res.status_code != 200:
         try:
             logger.error(res.json()['message'])