Pickling & decorators #499
Replies: 4 comments 25 replies
-
Hi @emptierset, how's it going? Thanks for reporting this! I noticed there aren't automated tests specifically for pickle. I did some manual tests in the past, and it worked fine back then. However, a lot has changed internally, so this might be a regression. State machines are meant to be serializable, but I'd love to understand your use case better. Could you share what you're trying to achieve by serializing the state machine? I'm asking because maybe an approach like this could be good enough. I'll set up an automated test to reproduce the issue. Do you happen to have a complete example that demonstrates the problem? Looking forward to your reply! |
Beta Was this translation helpful? Give feedback.
-
Thanks for your patience. I noticed that #500 got merged -- can I use the develop branch instead? I tried |
Beta Was this translation helpful? Give feedback.
-
Oh, it's just |
Beta Was this translation helpful? Give feedback.
-
We are running into other issues (like the one described in the OP) that make me feel like callbacks are not happening as expected, but I can't seem to produce an object with missing callbacks, like I was able to before. So it may not be a pickling issue (but I am still suspicious 🤷 ). Do you anticipate a new version sometime soon with the pickling logic? Overriding it myself in my own object is nontrivial because it seems you also did some refactoring work that renames things. Or, is |
Beta Was this translation helpful? Give feedback.
-
We are using this library for an implementation of a board game.
We need the ability to pickle and unpickle games. We are using
dill
for this because my initial attempts to pickle with basicpickle
saw failures[0] when it tried to pickle certain things insideStateMachine
. We noticed an interesting bug when unpicking saved games and I was wondering if you might have any input.Essentially, we have a transition list like this:
When playing a game after it was pickled and unpickled, sometimes it goes to
GAME_END
at surprising times, even if manually callinggame_is_over
via REPL shows that it is false. After some digging, I identified that thecond
isn't actually running, so the "game over" transition is always getting picked.Do you have any idea why pickling and/or unpickling causes
cond
to "fall off"?Is your expectation that state machines are serializable?
Do you think switching our codebase to a non-decorator approach would help?
[0]: Specifically, it failed with
AttributeError: Can't pickle local object 'SignatureAdapter.wrap.<locals>.signature_adapter'
.Beta Was this translation helpful? Give feedback.
All reactions