Skip to content

Commit

Permalink
docs: clarify how custom events are emitted in emit docstring (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
benhoyt authored Nov 22, 2023
1 parent 26c6e95 commit a8ba0bd
Showing 1 changed file with 12 additions and 1 deletion.
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 handler (emits custom_event_1)
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

0 comments on commit a8ba0bd

Please sign in to comment.