From cdda74d24d0f88f99451ed56cb49b9ade3828bd9 Mon Sep 17 00:00:00 2001 From: David Lobato Date: Thu, 21 Sep 2023 17:01:46 +0100 Subject: [PATCH] Make MultiResult pickable by adding getstate and setstate magic methods --- nornir/core/task.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nornir/core/task.py b/nornir/core/task.py index d063d8fb..83189ca4 100644 --- a/nornir/core/task.py +++ b/nornir/core/task.py @@ -257,6 +257,12 @@ def __getattr__(self, name: str) -> Any: def __repr__(self) -> str: return "{}: {}".format(self.__class__.__name__, super().__repr__()) + def __getstate__(self) -> Dict[str, Any]: + return self.__dict__ + + def __setstate__(self, d) -> None: + self.__dict__.update(d) + @property def failed(self) -> bool: """If ``True`` at least a task failed."""