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

Release event hooks when process is terminated #197

Closed
chrisjsewell opened this issue Jan 28, 2021 · 1 comment · Fixed by #200
Closed

Release event hooks when process is terminated #197

chrisjsewell opened this issue Jan 28, 2021 · 1 comment · Fixed by #200

Comments

@chrisjsewell
Copy link
Member

The three referencing lambda functions I identified in aiidateam/aiida-core#4603 (comment) are from plumpy.Process._setup_event_hooks (

plumpy/plumpy/processes.py

Lines 318 to 330 in 848028b

def _setup_event_hooks(self) -> None:
"""Set the event hooks to process, when it is created or loaded(recreated)."""
self.add_state_event_callback(
state_machine.StateEventHook.ENTERING_STATE,
lambda _s, _h, state: self.on_entering(cast(process_states.State, state))
)
self.add_state_event_callback(
state_machine.StateEventHook.ENTERED_STATE,
lambda _s, _h, from_state: self.on_entered(cast(Optional[process_states.State], from_state))
)
self.add_state_event_callback(
state_machine.StateEventHook.EXITING_STATE, lambda _s, _h, _state: self.on_exiting()
)
).
So I imagine these event hooks need to be removed, once the process enters a terminal state.

Originally posted by @chrisjsewell in aiidateam/aiida-core#4603 (comment)

@chrisjsewell
Copy link
Member Author

Also noted by @muhrin

Yes, good point! All those callbacks should be cleared on termination. I'm also wondering if there are any situations where a process has registered itself with the communicator for callbacks but doesn't un-register....

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 a pull request may close this issue.

1 participant