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

docs: clarify how custom events are emitted in emit docstring #1072

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ops/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,18 @@ def __init__(self, emitter: 'Object',
def emit(self, *args: Any, **kwargs: Any):
"""Emit event to all registered observers.

The current storage state is committed before and after each observer is notified.
The current storage state is committed before and after each observer
is notified.

Note that the emission of custom events is handled immediately. In
other words, custom events are not queued, but rather nested. For
example::

1. Main hook (emits custom_event_1)
benhoyt marked this conversation as resolved.
Show resolved Hide resolved
2. Custom event 1 handler (emits custom_event_2)
3. Custom event 2 handler
4. Resume custom event 1 handler
5. Resume main hook handler
"""
framework = self.emitter.framework
key = framework._next_event_key()
Expand Down
Loading