Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy and update __dict__ #176

Merged
merged 4 commits into from
Jan 30, 2024
Merged

Copy and update __dict__ #176

merged 4 commits into from
Jan 30, 2024

Conversation

liamhuber
Copy link
Member

Sometimes we mess with stuff in getstate, e.g. to avoid reflexive relationships between nodes and channels, but getting the state should never modify the current state, so always make a fresh dictionary. Similarly, the returned state might possibly not have all the content our current state does, so use update instead of overwriting.

Sometimes we mess with stuff in __getstate__, e.g. to avoid reflexive relationships between nodes and channels, but getting the state should never modify the current state, so always make a fresh dictionary. Similarly, the returned state might possibly not have all the content our current state does, so use update instead of overwriting.
In the case of running on an executor
Copy link

Binder 👈 Launch a binder notebook on branch pyiron/pyiron_workflow/copy_and_update

@liamhuber
Copy link
Member Author

Oops, forgot to branch first. Will force-push the original branch

By setting `running=False` on the local instance _before_ updating the state, we were then re-writing `running=True` when updating the state. Update the flag on the received instance as well, and add a test so the same issue doesn't crop up again.
@liamhuber liamhuber merged commit e4b1595 into composites_pass_self Jan 30, 2024
@liamhuber liamhuber deleted the copy_and_update branch January 30, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant