Merge lp:~thomir-deactivatedaccount/autopkgtest-result-checker/snappy-proposed-migration-fix-queue-names into lp:autopkgtest-result-checker/snappy-proposed-migration

Proposed by Thomi Richards
Status: Merged
Approved by: Thomi Richards
Approved revision: 17
Merged at revision: 17
Proposed branch: lp:~thomir-deactivatedaccount/autopkgtest-result-checker/snappy-proposed-migration-fix-queue-names
Merge into: lp:autopkgtest-result-checker/snappy-proposed-migration
Diff against target: 83 lines (+27/-15)
2 files modified
core_result_checker/__init__.py (+17/-5)
core_result_checker/constants.py (+10/-10)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/autopkgtest-result-checker/snappy-proposed-migration-fix-queue-names
Reviewer Review Type Date Requested Status
Kit Randel (community) code Approve
Review via email: mp+260074@code.launchpad.net

Commit message

Update queue & exchange names, fix a few lint issues.

Description of the change

Update queue & exchange names, fix a few lint issues.

To post a comment you must log in.
Revision history for this message
Kit Randel (blr) wrote :

Lacking some context, but looks correct.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'core_result_checker/__init__.py'
2--- core_result_checker/__init__.py 2015-05-21 01:53:57 +0000
3+++ core_result_checker/__init__.py 2015-05-25 21:25:00 +0000
4@@ -23,6 +23,7 @@
5 import os
6
7 import kombu
8+from kombu.pools import producers
9 from swiftclient.service import SwiftService
10 from uservice_utils.logging import (
11 configure_service_logging,
12@@ -221,9 +222,20 @@
13
14
15 def insert_payload_into_queue(connection, queue, payload):
16- q = connection.SimpleQueue(queue)
17- q.put(payload)
18- q.close()
19+ q = connection.SimpleQueue(queue)
20+ q.put(payload)
21+ q.close()
22+
23+
24+def insert_payload_into_fanout_exchange(connection, exchange_name, payload):
25+ with producers[connection].acquire(block=True) as producer:
26+ publisher = connection.ensure(
27+ producer,
28+ producer.publish,
29+ max_retries=3
30+ )
31+ exchange = kombu.Exchange(exchange_name, type="fanout")
32+ publisher(payload, exchange=exchange, declare=[exchange])
33
34
35 def main():
36@@ -258,9 +270,9 @@
37 constants.INPUT_QUEUE
38 )
39 complete_payload = partial(
40- insert_payload_into_queue,
41+ insert_payload_into_fanout_exchange,
42 connection,
43- constants.DONE_QUEUE
44+ constants.DONE_EXCHANGE,
45 )
46 queue_manager = QueueManager(
47 retry_payload,
48
49=== modified file 'core_result_checker/constants.py'
50--- core_result_checker/constants.py 2015-05-21 01:44:53 +0000
51+++ core_result_checker/constants.py 2015-05-25 21:25:00 +0000
52@@ -20,21 +20,21 @@
53 # Queue names are constant, rather than being defined in the config.
54
55 # The queue we listen to for new payloads to check:
56-INPUT_QUEUE = "core.result.v1"
57+INPUT_QUEUE = "snappy-proposed-migration.result"
58
59 # The queue we put fatally error'd payloads into:
60 DEAD_LETTER_QUEUE = "core.deadletters.v1"
61
62 # The queue we put payloads on to re-run the test:
63-TEST_RETRY_QUEUE = "core.tests.v1"
64-
65-# The queue we put results on:
66-DONE_QUEUE = "pm.results"
67-
68-
69-SOLUTION_NAME = "core-image-testing"
70-
71-SERVICE_NAME = "core-result-checker"
72+TEST_RETRY_QUEUE = "snappy-proposed-migration.package"
73+
74+# The exchange we put results on:
75+DONE_EXCHANGE = "results.exchange"
76+
77+
78+SOLUTION_NAME = "snappy-proposed-migration"
79+
80+SERVICE_NAME = "result-checker"
81
82
83 def _get_hostname():

Subscribers

People subscribed via source and target branches

to all changes: