I see process functions have access to an `open` m...
# troubleshooting
n
I see process functions have access to an
open
method to perform heavier initialization tasks on startup. When working with a broadcast process function, is there a way to get the broadcast state in there? I see methods available for getting other types of state but not broadcast.
My broadcast state is a map state, but it doesn't seem right to do a
get_map_state(<descriptor>)
The context is that I'd like to have certain state that is broadcasted and have my process function maintain some convenience lookups inside the class. I don't want to have to broadcast out all the lookups as well, but it would seem like I'd need a way to rebuild the lookups on startup from any existing broadcast state (e.g. in the event of a restart).
I suppose I don't need to do things on
open
. I could just as easily wait for a new broadcast or regular element to come through, detect that my lookups aren't built and then reconstruct them.
u
Operator state is not fully supported in PyFlink (only broadcast state) with some issues in chaining python operators, so you can’t do operator state initializing, like by implementing
CheckpointedFunction
in Java. But I think the “lazy initialization” you mentioned is quite a reasonable way to handle this situation.
n
I don’t need operator state I don’t think. I just wanted a way to gather broadcast state in my open method. It seemed like I had to wait until process element or process broadcast element was called to do that.