Skip to content

Commit

Permalink
RabbitMQ: Remove support for v3.5 and older
Browse files Browse the repository at this point in the history
RabbitMQ 3.5 has been EOL since 31 October 2016:

    https://www.rabbitmq.com/versions.html

This version required to explicitly run `support_deprecated_rabbitmq` on
the `pamqp` library (which is used all the way down the stack by
`aiormq` to handle interactions with RabbitMQ) to enable compatibility.
In removing this, the explicit dependency on `pamqp` is also removed.

The `aiida.manage.manager.is_rabbitmq_version_supported` function which
is used to check compatibility when a profile is loaded is updated to
include the lower bound.
  • Loading branch information
sphuber committed Nov 4, 2022
1 parent 69d6318 commit f016ab0
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rabbitmq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
rabbitmq: ['3.5', '3.6', '3.7', '3.8']
rabbitmq: ['3.6', '3.7', '3.8']

services:
postgres:
Expand Down
8 changes: 0 additions & 8 deletions aiida/manage/external/rmq/defaults.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
# -*- coding: utf-8 -*-
"""Defaults related to RabbitMQ."""
import pamqp.encode

from aiida.common.extendeddicts import AttributeDict

# The following statement enables support for RabbitMQ 3.5 because without it, connections established by `aiormq` will
# fail because the interpretation of the types of integers passed in connection parameters has changed after that
# version. Once RabbitMQ 3.5 is no longer supported (it has been EOL since October 2016) this can be removed. This
# should also allow to remove the direct dependency on `pamqp` entirely.
pamqp.encode.support_deprecated_rabbitmq()

__all__ = ('BROKER_DEFAULTS',)

LAUNCH_QUEUE = 'process.queue'
Expand Down
16 changes: 7 additions & 9 deletions aiida/manage/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Manager: # pylint: disable=too-many-public-methods
"""

def __init__(self) -> None:
"""Construct a new instance."""
# note: the config currently references the global variables
self._profile: Optional['Profile'] = None
self._profile_storage: Optional['StorageBackend'] = None
Expand Down Expand Up @@ -441,18 +442,13 @@ def create_daemon_runner(self, loop: Optional[asyncio.AbstractEventLoop] = None)
return runner

def check_rabbitmq_version(self, communicator: 'RmqThreadCommunicator'):
"""Check the version of RabbitMQ that is being connected to and emit warning if the version is not compatible.
Versions 3.8.15 and above are not compatible with AiiDA with default configuration.
"""
from packaging.version import parse

"""Check the version of RabbitMQ that is being connected to and emit warning if it is not compatible."""
from aiida.cmdline.utils import echo

show_warning = self.get_option('warnings.rabbitmq_version')
version = get_rabbitmq_version(communicator)

if show_warning and version >= parse('3.8.15'):
if show_warning and not is_rabbitmq_version_supported(communicator):
echo.echo_warning(f'RabbitMQ v{version} is not supported and will cause unexpected problems!')
echo.echo_warning('It can cause long-running workflows to crash and jobs to be submitted multiple times.')
echo.echo_warning('See https://github.com/aiidateam/aiida-core/wiki/RabbitMQ-version-to-use for details.')
Expand Down Expand Up @@ -487,12 +483,14 @@ def check_version(self):
def is_rabbitmq_version_supported(communicator: 'RmqThreadCommunicator') -> bool:
"""Return whether the version of RabbitMQ configured for the current profile is supported.
Versions 3.8.15 and above are not compatible with AiiDA with default configuration.
Versions 3.5 and below are not supported at all, whereas versions 3.8.15 and above are not compatible with a default
configuration of the RabbitMQ server.
:return: boolean whether the current RabbitMQ version is supported.
"""
from packaging.version import parse
return get_rabbitmq_version(communicator) < parse('3.8.15')
version = get_rabbitmq_version(communicator)
return parse('3.6.0') <= version < parse('3.8.15')


def get_rabbitmq_version(communicator: 'RmqThreadCommunicator'):
Expand Down
2 changes: 1 addition & 1 deletion docs/source/intro/install_system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ System-wide installation
The system-wide installation will install the prerequisite services (PostgreSQL and RabbitMQ) via standard package managers such that their startup and shut-down is largely managed by the operating system.
The AiiDA (core) Python package is then installed either with Conda or pip.

.. warning:: AiiDA is currently not compatible with RabbitMQ v3.8.15 and up with default configurations. For details refer to the :ref:`dedicated troubleshooting section<intro:troubleshooting:installation:rabbitmq>`.
.. warning:: RabbitMQ v3.5 and below are EOL and not supported at all. For versions RabbitMQ v3.8.15 and up, AiiDA is not compatible with default server configurations. For details refer to the :ref:`dedicated troubleshooting section<intro:troubleshooting:installation:rabbitmq>`.

This is the *recommended* installation method to setup AiiDA on a personal laptop or workstation for the majority of users.

Expand Down
3 changes: 2 additions & 1 deletion docs/source/intro/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Installation issues
RabbitMQ incompatibility
........................

AiiDA is currently not compatible with RabbitMQ v3.8.15 and up with default configuration.
RabbitMQ v3.5 and older are `end-of-life <https://www.rabbitmq.com/versions.html>`_ and are not supported in any way.
For RabbitMQ v3.8.15 and up, AiiDA is not compatible with the default configuration of the server.
When AiiDA is run with an incompatible version of RabbitMQ, the following warning will be displayed:

.. code-block:: console
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:
- kiwipy[rmq]~=0.7.5
- importlib-metadata~=4.3
- numpy~=1.19
- pamqp~=2.3
- paramiko>=2.7.2,~=2.7
- plumpy~=0.21.0
- pgsu~=0.2.1
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ dependencies = [
"kiwipy[rmq]~=0.7.5",
"importlib-metadata~=4.3",
"numpy~=1.19",
"pamqp~=2.3",
"paramiko~=2.7,>=2.7.2",
"plumpy~=0.21.0",
"pgsu~=0.2.1",
Expand Down
1 change: 0 additions & 1 deletion requirements/requirements-py-3.10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ notebook==6.4.10
numpy==1.22.0
packaging==21.3
palettable==3.3.0
pamqp==2.3.0
pandas==1.3.4
pandocfilters==1.5.0
paramiko==2.10.1
Expand Down
1 change: 0 additions & 1 deletion requirements/requirements-py-3.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ notebook==6.4.10
numpy==1.22.0
packaging==21.3
palettable==3.3.0
pamqp==2.3.0
pandas==1.3.4
pandocfilters==1.5.0
paramiko==2.10.1
Expand Down
1 change: 0 additions & 1 deletion requirements/requirements-py-3.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ notebook==6.4.10
numpy==1.22.0
packaging==21.3
palettable==3.3.0
pamqp==2.3.0
pandas==1.3.4
pandocfilters==1.5.0
paramiko==2.10.1
Expand Down
23 changes: 23 additions & 0 deletions tests/manage/test_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
"""Tests for the :mod:`aiida.manage.manager` module."""
from packaging.version import parse
import pytest

from aiida.manage import manager


@pytest.mark.parametrize(('version', 'supported'), (
('3.5', False),
('3.6', True),
('3.6.0', True),
('3.6.1', True),
('3.8', True),
('3.8.14', True),
('3.8.15', False),
('3.9.0', False),
('3.9', False),
))
def test_is_rabbitmq_version_supported(monkeypatch, version, supported, communicator):
"""Test the :func:`aiida.manage.manager.is_rabbitmq_version_supported`."""
monkeypatch.setattr(manager, 'get_rabbitmq_version', lambda communicator: parse(version))
assert manager.is_rabbitmq_version_supported(communicator) is supported

0 comments on commit f016ab0

Please sign in to comment.