Bug 1251515 - artifactsTask is resolved regardless of parent's task result r=jlund DONTBUILD
authorRail Aliiev <rail@mozilla.com>
Sat, 27 Feb 2016 12:17:26 -0800
changeset 304349 999aa9cf849d0b37b864df1478575d045ef2cf89
parent 304348 d61c0c229f7b8c1fe56e626229c23c8ad9007124
child 304350 9434b9caa66c200dca1a7f01ec8b8e442e4c38a4
push id9175
push userraliiev@mozilla.com
push dateThu, 03 Mar 2016 03:39:52 +0000
treeherdermozilla-aurora@0bee186afe5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlund
bugs1251515
milestone46.0a2
Bug 1251515 - artifactsTask is resolved regardless of parent's task result r=jlund DONTBUILD MozReview-Commit-ID: 39a8StJ72bc
testing/mozharness/mozharness/mozilla/taskcluster_helper.py
testing/mozharness/scripts/desktop_l10n.py
--- a/testing/mozharness/mozharness/mozilla/taskcluster_helper.py
+++ b/testing/mozharness/mozharness/mozilla/taskcluster_helper.py
@@ -129,16 +129,24 @@ class Taskcluster(LogMixin):
 
     def report_completed(self, task):
         task_id = task['status']['taskId']
         run_id = task['status']['runs'][-1]['runId']
         self.info("Resolving %s, run %s. Full task:" % (task_id, run_id))
         self.info(str(task))
         self.taskcluster_queue.reportCompleted(task_id, run_id)
 
+    def report_failed(self, task):
+        task_id = task['status']['taskId']
+        run_id = task['status']['runs'][-1]['runId']
+        self.info("Resolving %s as failed, run %s. Full task:" %
+                  (task_id, run_id))
+        self.info(str(task))
+        self.taskcluster_queue.reportFailed(task_id, run_id)
+
     def get_taskcluster_url(self, filename):
         return 'https://queue.taskcluster.net/v1/task/%s/artifacts/public/build/%s' % (
             self.task_id,
             os.path.basename(filename)
         )
 
 
 # TasckClusterArtifactFinderMixin {{{1
--- a/testing/mozharness/scripts/desktop_l10n.py
+++ b/testing/mozharness/scripts/desktop_l10n.py
@@ -41,16 +41,19 @@ try:
 except ImportError:
     import json
 
 
 # needed by _map
 SUCCESS = 0
 FAILURE = 1
 
+SUCCESS_STR = "Success"
+FAILURE_STR = "Failed"
+
 # when running get_output_form_command, pymake has some extra output
 # that needs to be filtered out
 PyMakeIgnoreList = [
     re.compile(r'''.*make\.py(?:\[\d+\])?: Entering directory'''),
     re.compile(r'''.*make\.py(?:\[\d+\])?: Leaving directory'''),
 ]
 
 
@@ -486,33 +489,37 @@ class DesktopSingleLocale(LocalesMixin, 
             else:
                 #  func failed...
                 message = 'failure: %s(%s)' % (name, item)
                 self._add_failure(item, message)
         return (success_count, total_count)
 
     def _add_failure(self, locale, message, **kwargs):
         """marks current step as failed"""
-        self.locales_property[locale] = "Failed"
+        self.locales_property[locale] = FAILURE_STR
         prop_key = "%s_failure" % locale
         prop_value = self.query_buildbot_property(prop_key)
         if prop_value:
             prop_value = "%s  %s" % (prop_value, message)
         else:
             prop_value = message
         self.set_buildbot_property(prop_key, prop_value, write_to_file=True)
         BaseScript.add_failure(self, locale, message=message, **kwargs)
 
+    def query_failed_locales(self):
+        return [l for l, res in self.locales_property.items() if
+                res == FAILURE_STR]
+
     def summary(self):
         """generates a summary"""
         BaseScript.summary(self)
         # TODO we probably want to make this configurable on/off
         locales = self.query_locales()
         for locale in locales:
-            self.locales_property.setdefault(locale, "Success")
+            self.locales_property.setdefault(locale, SUCCESS_STR)
         self.set_buildbot_property("locales",
                                    json.dumps(self.locales_property),
                                    write_to_file=True)
 
     # Actions {{{2
     def clobber(self):
         """clobber"""
         dirs = self.query_abs_dirs()
@@ -1030,14 +1037,20 @@ class DesktopSingleLocale(LocalesMixin, 
                 artifact_url = tc.create_artifact(task, upload_file)
                 if artifacts_task:
                     artifacts_tc.create_reference_artifact(
                             artifacts_task, upload_file, artifact_url)
 
             tc.report_completed(task)
 
         if artifacts_task:
-            artifacts_tc.report_completed(artifacts_task)
+            if not self.query_failed_locales():
+                artifacts_tc.report_completed(artifacts_task)
+            else:
+                # If some locales fail, we want to mark the artifacts
+                # task failed, so a retry can reuse the same task ID
+                artifacts_tc.report_failed(artifacts_task)
+
 
 # main {{{
 if __name__ == '__main__':
     single_locale = DesktopSingleLocale()
     single_locale.run_and_exit()