Merge autopkgtest-cloud:queues-not-created into autopkgtest-cloud:master

Proposed by Brian Murray
Status: Merged
Merged at revision: 3bf958da010a1b14a8b9451861afa3f7688b41e4
Proposed branch: autopkgtest-cloud:queues-not-created
Merge into: autopkgtest-cloud:master
Diff against target: 21 lines (+9/-1)
1 file modified
charms/focal/autopkgtest-web/webcontrol/cache-amqp (+9/-1)
Reviewer Review Type Date Requested Status
Paride Legovini Approve
Ubuntu Release Team Pending
Review via email: mp+425677@code.launchpad.net

Description of the change

A fresh deploy of the autopkgtest mojo spec will encounter a Traceback when `webcontrol/cache-amqp` is run e.g:

ubuntu@juju-806ee7-stg-proposed-migration-57:~$ webcontrol/cache-amqp --debug
2022-06-24 21:09:49: Connected to AMQP host 10.15.190.67
2022-06-24 21:09:49: Semaphore queue 'semaphore-ubuntu-impish-s390x' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-ubuntu-impish-armhf' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-ubuntu-impish-amd64' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-ubuntu-jammy-amd64' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-huge-impish-s390x' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-huge-impish-armhf' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-huge-impish-amd64' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-huge-jammy-amd64' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-ppa-impish-s390x' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-ppa-impish-armhf' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-ppa-impish-amd64' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-ppa-jammy-amd64' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-upstream-impish-s390x' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-upstream-impish-armhf' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-upstream-impish-amd64' exists
2022-06-24 21:09:49: Semaphore queue 'semaphore-upstream-jammy-amd64' exists
2022-06-24 21:09:49: Trying to lock semaphore queue semaphore-ubuntu-impish-s390x...
2022-06-24 21:09:49: ...locked.
Traceback (most recent call last):
  File "webcontrol/cache-amqp", line 240, in <module>
    queue_contents = aq.get_queue_contents()
  File "webcontrol/cache-amqp", line 159, in get_queue_contents
    requests = self.get_queue_requests(queue_name)
  File "webcontrol/cache-amqp", line 98, in get_queue_requests
    r = self.amqp_channel.basic_get(queue_name)
  File "/usr/lib/python3/dist-packages/amqplib/client_0_8/channel.py", line 2117, in basic_get
    return self.wait(allowed_methods=[
  File "/usr/lib/python3/dist-packages/amqplib/client_0_8/abstract_channel.py", line 97, in wait
    return self.dispatch_method(method_sig, args, content)
  File "/usr/lib/python3/dist-packages/amqplib/client_0_8/abstract_channel.py", line 115, in dispatch_method
    return amqp_method(self, args)
  File "/usr/lib/python3/dist-packages/amqplib/client_0_8/channel.py", line 272, in _close
    raise AMQPChannelException(reply_code, reply_text,
amqplib.client_0_8.exceptions.AMQPChannelException: (404, "NOT_FOUND - no queue 'debci-impish-s390x' in vhost '/'", (60, 70), 'Channel.basic_get')

The queues will be created when tests are submitted and cache-amqp should handle them not being there yet.

To post a comment you must log in.
Revision history for this message
Paride Legovini (paride) wrote :

This LGTM and I see the same logic is used elsewhere.
I wonder if

  # 404s invalidate the channel for some reason
  self.amqp_channel = self.amqp_con.channel()

is really needed here, but I'm +1 with keeping it.

review: Approve
Revision history for this message
Brian Murray (brian-murray) wrote :

> This LGTM and I see the same logic is used elsewhere.
> I wonder if
>
> # 404s invalidate the channel for some reason
> self.amqp_channel = self.amqp_con.channel()
>
> is really needed here, but I'm +1 with keeping it.

I tried not including it and come to find out it is really needed!

2022-06-28 00:40:40: Queue debci-impish-s390x has 0 items
2022-06-28 00:40:40: Trying to lock semaphore queue semaphore-ubuntu-impish-armhf...
2022-06-28 00:40:40: ...locked.
Traceback (most recent call last):
  File "webcontrol/cache-amqp", line 246, in <module>
    queue_contents = aq.get_queue_contents()
  File "webcontrol/cache-amqp", line 160, in get_queue_contents
    requests = self.get_queue_requests(queue_name)
  File "webcontrol/cache-amqp", line 98, in get_queue_requests
    r = self.amqp_channel.basic_get(queue_name)
  File "/usr/lib/python3/dist-packages/amqplib/client_0_8/channel.py", line 2116, in basic_get
    self._send_method((60, 70), args)
  File "/usr/lib/python3/dist-packages/amqplib/client_0_8/abstract_channel.py", line 75, in _send_method
    self.connection.method_writer.write_method(self.channel_id,
AttributeError: 'NoneType' object has no attribute 'method_writer'

Revision history for this message
Paride Legovini (paride) wrote :

Thanks for verifying!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charms/focal/autopkgtest-web/webcontrol/cache-amqp b/charms/focal/autopkgtest-web/webcontrol/cache-amqp
2index 0c99972..c32ea40 100755
3--- a/charms/focal/autopkgtest-web/webcontrol/cache-amqp
4+++ b/charms/focal/autopkgtest-web/webcontrol/cache-amqp
5@@ -156,7 +156,15 @@ class AutopkgtestQueueContents:
6 queue_name = "debci-%s-%s" % (release, arch)
7 else:
8 queue_name = "debci-%s-%s-%s" % (context, release, arch)
9- requests = self.get_queue_requests(queue_name)
10+ try:
11+ requests = self.get_queue_requests(queue_name)
12+ except AMQPChannelException as e:
13+ (code, _, _, _) = e.args
14+ if code != 404:
15+ raise
16+ requests = []
17+ # 404s invalidate the channel for some reason
18+ self.amqp_channel = self.amqp_con.channel()
19 queue_size = len(requests)
20 logging.info(
21 "Queue %s has %d items", queue_name, queue_size

Subscribers

People subscribed via source and target branches