Bug 1251515 – artifactsTask is resolved regardless of parent's task result r=jlund DONTBUILD
☠☠ backed out by a4929411c0aa ☠ ☠
authorRail Aliiev <rail@mozilla.com>
Sat, 27 Feb 2016 12:17:26 -0800
changeset 322517 4ca277948a4200c5a49fac7563f1aee77caca071
parent 322516 25b27835c872681a8e97ba1ba27fd5e0acd398d8
child 322518 f15256eba7242fdad6997f9a8fb9aec73b8747bb
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlund
bugs1251515
milestone47.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 1251515 – artifactsTask is resolved regardless of parent's task result r=jlund DONTBUILD MozReview-Commit-ID: A9dhRmLniRd
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()