diff --git a/src/plumpy/exceptions.py b/src/plumpy/exceptions.py index 68113cc5..2f290e6a 100644 --- a/src/plumpy/exceptions.py +++ b/src/plumpy/exceptions.py @@ -1,12 +1,8 @@ # -*- coding: utf-8 -*- from typing import Optional -from aio_pika.exceptions import ChannelInvalidStateError, ConnectionClosed - __all__ = [ 'ClosedError', - 'CommunicatorChannelInvalidStateError', - 'CommunicatorConnectionClosed', 'InvalidStateError', 'KilledError', 'PersistenceError', @@ -43,7 +39,3 @@ class PersistenceError(Exception): class ClosedError(Exception): """Raised when an mutable operation is attempted on a closed process""" - -# Alias aio_pika -CommunicatorConnectionClosed = ConnectionClosed -CommunicatorChannelInvalidStateError = ChannelInvalidStateError diff --git a/src/plumpy/processes.py b/src/plumpy/processes.py index fe715857..c8159ec6 100644 --- a/src/plumpy/processes.py +++ b/src/plumpy/processes.py @@ -696,7 +696,7 @@ def on_entering(self, state: process_states.State) -> None: call_with_super_check(self.on_except, state.get_exc_info()) # type: ignore def on_entered(self, from_state: Optional[process_states.State]) -> None: - from plumpy.exceptions import CommunicatorChannelInvalidStateError, CommunicatorConnectionClosed + from plumpy.rmq.exceptions import CommunicatorChannelInvalidStateError, CommunicatorConnectionClosed # Map these onto direct functions that the subclass can implement state_label = self._state.LABEL diff --git a/src/plumpy/rmq/__init__.py b/src/plumpy/rmq/__init__.py new file mode 100644 index 00000000..31d97783 --- /dev/null +++ b/src/plumpy/rmq/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +from .exceptions import * + +__all__ = exceptions.__all__ diff --git a/src/plumpy/rmq/exceptions.py b/src/plumpy/rmq/exceptions.py new file mode 100644 index 00000000..b15d51c4 --- /dev/null +++ b/src/plumpy/rmq/exceptions.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +from aio_pika.exceptions import ChannelInvalidStateError, ConnectionClosed + +__all__ = [ + 'CommunicatorChannelInvalidStateError', + 'CommunicatorConnectionClosed', +] + +# Alias aio_pika +CommunicatorConnectionClosed = ConnectionClosed +CommunicatorChannelInvalidStateError = ChannelInvalidStateError