Merge lp:~thomir-deactivatedaccount/autopkgtest-result-checker/snappy-image-tests-queues-in-code into lp:autopkgtest-result-checker/snappy-image-tests

Proposed by Thomi Richards
Status: Merged
Approved by: Thomi Richards
Approved revision: 16
Merged at revision: 16
Proposed branch: lp:~thomir-deactivatedaccount/autopkgtest-result-checker/snappy-image-tests-queues-in-code
Merge into: lp:autopkgtest-result-checker/snappy-image-tests
Diff against target: 79 lines (+17/-7)
2 files modified
core_result_checker/__init__.py (+6/-6)
core_result_checker/constants.py (+11/-1)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/autopkgtest-result-checker/snappy-image-tests-queues-in-code
Reviewer Review Type Date Requested Status
Para Siva (community) Needs Fixing
Thomi Richards (community) Approve
Paul Larson Pending
Celso Providelo Pending
Review via email: mp+259859@code.launchpad.net

This proposal supersedes a proposal from 2015-05-20.

Commit message

Move queue names into constants module.

Description of the change

Move queue names into constants module.

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote : Posted in a previous version of this proposal

This looks good. Was this discussed as something we want to move to doing on all the services, or was this specific to the needs of autopkgtest-result-checker?

review: Approve
Revision history for this message
Celso Providelo (cprov) wrote : Posted in a previous version of this proposal

It looks very nice and explores contstants.py to our benefit, because currently we know that most service context changes will imply only in different constants (logic remains the same).

As we see the need to deploy other services in different contexts the their original one, we should probably execute land a similar patch to isolate queue names in constants.py.

[]

review: Approve
Revision history for this message
Para Siva (psivaa) wrote : Posted in a previous version of this proposal

+1, This is a very justifiable middle ground which is even better than the other two extremes.

review: Approve
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) :
review: Approve
Revision history for this message
Para Siva (psivaa) wrote :

It's a little confusing to have the queue names not matching the branch name. I realize it will be more work to change the queue names to include 'snappy' in it.

I'd prefer the name of the branch to lp:autopkgtest-result-checker/core-image-tests or some sort to include 'core' in it.

review: Needs Fixing

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-04-07 21:45:33 +0000
3+++ core_result_checker/__init__.py 2015-05-21 21:55:04 +0000
4@@ -170,7 +170,7 @@
5 if retry_count < self.max_retries:
6 payload['test_run_retry_count'] = retry_count + 1
7 self._insert_payload_into_queue(
8- "core.tests.{}".format(constants.API_VERSION),
9+ constants.TEST_RETRY_QUEUE,
10 payload
11 )
12 else:
13@@ -180,7 +180,7 @@
14 "letter queue"
15 )
16 self._insert_payload_into_queue(
17- "core.deadletters.{}".format(constants.API_VERSION),
18+ constants.DEAD_LETTER_QUEUE,
19 payload
20 )
21
22@@ -209,7 +209,7 @@
23 "Requeueing message since swift is not yet consistent"
24 )
25 self._insert_payload_into_queue(
26- "core.result.{}".format(constants.API_VERSION),
27+ constants.INPUT_QUEUE,
28 payload
29 )
30 else:
31@@ -219,7 +219,7 @@
32 self.swift_retry_seconds
33 )
34 self._insert_payload_into_queue(
35- "core.deadletters.{}".format(constants.API_VERSION),
36+ constants.DEAD_LETTER_QUEUE,
37 payload
38 )
39
40@@ -241,7 +241,7 @@
41 amqp_uris = config.get('amqp', 'uris').split()
42 retry_policy = DefaultRetryPolicy(
43 max_retries=3,
44- dead_queue='core.deadletters.{}'.format(constants.API_VERSION)
45+ dead_queue=constants.DEAD_LETTER_QUEUE
46 )
47 try:
48 with kombu.Connection(amqp_uris) as connection:
49@@ -250,7 +250,7 @@
50 worker = Worker(swift_manager, retry_publisher)
51 queue_monitor = SimpleRabbitQueueWorker(
52 connection,
53- "core.result.{}".format(constants.API_VERSION),
54+ constants.INPUT_QUEUE,
55 worker,
56 retry_policy,
57 )
58
59=== modified file 'core_result_checker/constants.py'
60--- core_result_checker/constants.py 2015-04-01 02:02:29 +0000
61+++ core_result_checker/constants.py 2015-05-21 21:55:04 +0000
62@@ -17,7 +17,17 @@
63
64 """Constants for this service."""
65
66-API_VERSION = "v1"
67+# Queue names are constant, rather than being defined in the config.
68+
69+# The queue we listen to for new payloads to check:
70+INPUT_QUEUE = "core.result.v1"
71+
72+# The queue we put fatally error'd payloads into:
73+DEAD_LETTER_QUEUE = "core.deadletters.v1"
74+
75+# The queue we put payloads on to re-run the test:
76+TEST_RETRY_QUEUE = "core.tests.v1"
77+
78
79 SOLUTION_NAME = "core-image-testing"
80

Subscribers

People subscribed via source and target branches

to all changes: