Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: PFUN-16840

...

When the calculation is executed, each item created will have the elements associated to the Item context be executed. In this case it means that for each of the 10 created items in the Init context, the code above will be executed and the Item element output will be the item’s associated value (theValue) multiplied by two.

⚠️ For parallel calculations to work correctly, it is important to ensure that the calculation of each item is always idempotent because, by design, items are meant to be calculable multiple times (e.g., in case of infrastructure errors, but also if the user decides to recalculate some items). In practical terms, this means that the parallel calculation logic elements of Item context should be careful when mutating external state, and in particular when using model.loadTable. For example, a typical use case is to load new rows in a Model Table for each item and calculating multiple times the same item should not add more rows but overwrite existing ones: usually the simplest way of enforcing this is to ensure that the tables where the items are loaded are using keys that match unique criteria of the items.

Summarizing Items, Summary Context

...