Coder Social home page Coder Social logo

Comments (4)

gyan-sag avatar gyan-sag commented on September 21, 2024

I think it may be tricky to support this for partitioned models.
In partitioned models, the state is separately maintained for each partition (devices). And the correct state for correct partition is passed to the $process action when evaluating model for that partition. For $init and $validate action, it is unclear which state to pass. Calling $init and $validate action for each partition is unreasonable as number of partition may be unknown at the startup - for example receiving from all inputs.
If partition agnostic data is store in the state during the $init and $validate call, then we can probably have a separate state for passing to the $init and $validate action and then clone it to create a partition specific state when first input for a specific partition is received.

from apama-analytics-builder-block-sdk.

haraldmeyer avatar haraldmeyer commented on September 21, 2024

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?

from apama-analytics-builder-block-sdk.

gyan-sag avatar gyan-sag commented on September 21, 2024

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 $init action on the state event itself which can be called when new state object is created for a partition.

event MyBlock_$State {
  MyBlock_$Parameters $parameters;
  ...
  action $init() { // Called when new instance of this event is created
    ...
  }
}

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.

from apama-analytics-builder-block-sdk.

haraldmeyer avatar haraldmeyer commented on September 21, 2024

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.

from apama-analytics-builder-block-sdk.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.