-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support block state in $init and $validate #12
Comments
I think it may be tricky to support this for partitioned models. |
ok, understood. That makes sense. What about having a field in the Activation object that indicates if this is the first time $process has been called for a partition? Or is there another way to determine that? |
Adding action on Activation would not work either because the same activation object is used across all blocks when evaluating a model but you need status per-block and not per-model. Besides that, I don't think it would be too much improvement as you would still have to check if init is already done or not. Maybe we can support
Also, if you are computing values from parameters which does not change with inputs and across partitions, you do not need to use state object. You can directly store values in a filed on the block event itself. |
Your last comment is spot on: my requirement can actually be fulfilled without storing the derived parameters in a state object. Did not consider this as I needed the state for other purposes anyway. I have a hard time finding other use cases at the moment, so unsure if this feature is really required. I like your suggestion about $init but not that it would require another field $parameters that you would need to know to add by convention. |
In some cases, it can make sense to populate the state already during the $init or $validation actions if the state can be derived for the parameters and connected inputs and / or will not change afterwards (e.g. converting a human-readable parameter into a format that can be better used in the EPL implementation).
At the moment, one would have to implement this in $process and check if it has already been populated to avoid doing it every time.
The text was updated successfully, but these errors were encountered: