Merge lp:~cprov/adt-cloud-worker/int-error into lp:adt-cloud-worker

Proposed by Celso Providelo
Status: Merged
Approved by: Celso Providelo
Approved revision: 33
Merged at revision: 33
Proposed branch: lp:~cprov/adt-cloud-worker/int-error
Merge into: lp:adt-cloud-worker
Diff against target: 35 lines (+7/-4)
1 file modified
adt_cloud_worker/__init__.py (+7/-4)
To merge this branch: bzr merge lp:~cprov/adt-cloud-worker/int-error
Reviewer Review Type Date Requested Status
Thomi Richards (community) Approve
Review via email: mp+253905@code.launchpad.net

Commit message

Fix special 'exit_code' value to 100 (int not string) and also include traceback information in the message payload for helping later debug.

Description of the change

Fix special 'exit_code' value to 100 (int not string) and also include traceback information in the message payload for helping later debug.

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

LGTM - we need to be careful about where we publish tracebacks to, but in this case the rabbitmq messages are always private.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'adt_cloud_worker/__init__.py'
2--- adt_cloud_worker/__init__.py 2015-03-20 19:17:25 +0000
3+++ adt_cloud_worker/__init__.py 2015-03-24 01:56:50 +0000
4@@ -31,6 +31,7 @@
5 import subprocess
6 import tarfile
7 import tempfile
8+import traceback
9
10 from adt_cloud_worker._cloud_support import (
11 get_default_testbed_flavor,
12@@ -118,17 +119,19 @@
13 container_name = 'adt-{}'.format(body['request_id'])
14 upload_tarball_to_swift_container(tarball_path, container_name)
15 except Exception as e:
16- # Unexpected failures ...
17- body['exit_code'] = '100'
18+ # Unexpected failures are tagged with special exit_code 100 and
19+ # carry the worker_traceback in the message payload. This will
20+ # help debugging of deadletter-ed messages.
21+ body['exit_code'] = 100
22+ body['worker_traceback'] = traceback.format_exc()
23 logger.error(e, exc_info=True, extra=body)
24 finally:
25 logger.info('Posting results: %s', body, extra=body)
26- # TODO: send error logging to result-checker in the message.
27 queue = self.connection.SimpleQueue(
28 'adt.results.{}'.format(API_VERSION))
29 queue.put(body)
30 queue.close()
31- if tarball_path and os.path.exists(tarball_path):
32+ if tarball_path is not None and os.path.exists(tarball_path):
33 os.remove(tarball_path)
34 message.ack()
35 logger.info('Done!', extra=body)

Subscribers

People subscribed via source and target branches