diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 216: fix bug 921632: still submit some results even if retrieve_results blows up

Message ID 20120202015810.1746.17441.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson Feb. 2, 2012, 1:58 a.m. UTC
------------------------------------------------------------
revno: 216
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Thu 2012-02-02 14:56:11 +1300
message:
  fix bug 921632: still submit some results even if retrieve_results blows up
modified:
  lava_dispatcher/actions/launch_control.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dispatcher/actions/launch_control.py'
--- lava_dispatcher/actions/launch_control.py	2012-01-09 23:20:01 +0000
+++ lava_dispatcher/actions/launch_control.py	2012-02-02 01:56:11 +0000
@@ -107,24 +107,29 @@ 
         :param stream: Stream on the lava-dashboard server to save the result to
         """
 
-        status, err_msg, result_path = self.client.retrieve_results(result_disk)
-        if result_path is not None:
-            try:
-                tar = tarfile.open(result_path)
-                for tarinfo in tar:
-                    if os.path.splitext(tarinfo.name)[1] == ".bundle":
-                        f = tar.extractfile(tarinfo)
-                        content = f.read()
-                        f.close()
-                        self.all_bundles.append(json.loads(content))
-                tar.close()
-            except:
-                logging.warning(traceback.format_exc())
-                status = 'fail'
-                err_msg = err_msg + " Some test case result appending failed."
-                logging.warning(err_msg)
-            finally:
-                shutil.rmtree(os.path.dirname(result_path))
+        err_msg = None
+        status = 'fail'
+        try:
+            status, err_msg, result_path = self.client.retrieve_results(result_disk)
+            if result_path is not None:
+                try:
+                    tar = tarfile.open(result_path)
+                    for tarinfo in tar:
+                        if os.path.splitext(tarinfo.name)[1] == ".bundle":
+                            f = tar.extractfile(tarinfo)
+                            content = f.read()
+                            f.close()
+                            self.all_bundles.append(json.loads(content))
+                    tar.close()
+                except:
+                    logging.warning(traceback.format_exc())
+                    status = 'fail'
+                    err_msg = err_msg + " Some test case result appending failed."
+                    logging.warning(err_msg)
+                finally:
+                    shutil.rmtree(os.path.dirname(result_path))
+        except:
+            logging.exception('retrieve_results failed')
 
         if err_msg is None:
             err_msg = ''