You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Register the loop state on Python operators before process_state #8641
Inside a control block (LoopStart/LoopEnd), the iteration's loop variables reach every operator as a state message. A Python operator sees that message only as the argument of process_state, so any other callback, such as process_tuple, has no way to read the current iteration's variables unless the author stores them by hand.
Proposed Solution or Design
Register the state on the operator before the callback runs, the same for every Python operator:
Operator gains a state attribute, None until a state message arrives. LoopStart and LoopEnd, which kept their own loop variables in self.state, keep them in self.variables instead.
The Python worker sets operator.state right before it calls process_state. That covers DataProcessor.process_state and the LoopEnd's deferred consume in the main loop, which calls the operator directly.
The default process_state is unchanged and still forwards the state downstream.
This is the Python counterpart of the JVM registration in #8635, split into its own change.
Activity
feat(pyamber): register the state before process_state (#8642)