Skip to content

Commit

Permalink
Defer the import of plumpy exception thus aiopika
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Dec 11, 2024
1 parent baf8d7c commit d661549
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/aiida/engine/processes/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import plumpy.processes
from kiwipy.communications import UnroutableError
from plumpy.process_states import Finished, ProcessState
from plumpy.processes import ConnectionClosed # type: ignore[attr-defined]
from plumpy.processes import Process as PlumpyProcess
from plumpy.utils import AttributesFrozendict

Expand Down Expand Up @@ -334,6 +333,8 @@ def kill(self, msg: Union[str, None] = None) -> Union[bool, plumpy.futures.Futur
:param msg: message
"""
from plumpy.exceptions import CommunicatorConnectionClosed

self.node.logger.info(f'Request to kill Process<{self.node.pk}>')

had_been_terminated = self.has_terminated()
Expand All @@ -352,7 +353,7 @@ def kill(self, msg: Union[str, None] = None) -> Union[bool, plumpy.futures.Futur
result = asyncio.wrap_future(result) # type: ignore[arg-type]
if asyncio.isfuture(result):
killing.append(result)
except ConnectionClosed:
except CommunicatorConnectionClosed:
self.logger.info('no connection available to kill child<%s>', child.pk)
except UnroutableError:
self.logger.info('kill signal was unable to reach child<%s>', child.pk)
Expand Down

0 comments on commit d661549

Please sign in to comment.