Bug 1273673: log task creation, too; r?gps draft
authorDustin J. Mitchell <dustin@mozilla.com>
Wed, 18 May 2016 15:58:21 +0000
changeset 368348 edfce7f50cf67a0e1c449b4764a63f872b7795e9
parent 368346 2662ced404b4e6826d3d63fb8a53ec1cb2addd62
child 521231 7ad88e434e30f1033ad1f139eadb9e8b847af03e
push id18493
push userdmitchell@mozilla.com
push dateWed, 18 May 2016 15:58:33 +0000
reviewersgps
bugs1273673
milestone49.0a1
Bug 1273673: log task creation, too; r?gps MozReview-Commit-ID: K2Pn4WDXsxo
taskcluster/taskgraph/create.py
--- a/taskcluster/taskgraph/create.py
+++ b/taskcluster/taskgraph/create.py
@@ -2,19 +2,22 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import requests
 import json
 import collections
+import logging
 
 from slugid import nice as slugid
 
+logger = logging.getLogger(__name__)
+
 def create_tasks(taskgraph):
     # TODO: use the taskGroupId of the decision task
     task_group_id = slugid()
     label_to_taskid = collections.defaultdict(slugid)
 
     session = requests.Session()
 
     for label in taskgraph.graph.visit_postorder():
@@ -28,16 +31,16 @@ def create_tasks(taskgraph):
         task_def['dependencies'] = deps_by_name.values()
         task_def['requires'] = 'all-completed'
 
         _create_task(session, label_to_taskid[label], label, task_def)
 
 def _create_task(session, task_id, label, task_def):
     # create the task using 'http://taskcluster/queue', which is proxied to the queue service
     # with credentials appropriate to this job.
-    print("Creating task with taskId {} for {}".format(task_id, label))
+    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:
-            print(res.json()['message'])
+            logger.error(res.json()['message'])
         except:
-            print(res.text)
+            logger.error(res.text)
         res.raise_for_status()