The purpose is the same as of the Model Calculation Logic. This article describes only differences in Logic API between the simple and parallel model calculation logic.
The parallel calculation is executed in 3 steps and are mainly used to implement use cases, where it is required to calculate many independent items in parallel. In practice, those items are calculated in a distributed manner (see also Distributed Calculation).
See Build and Use Parallel Calculation for a simple how-to on writing and using such logics.
Logic API
Logic Nature:
model_parallel_calculation
Logic Type: Calculation/Pricing
Execution Types:
Init – Prepares the list of items to be calculated in parallel. Only logic elements with element context “Init” will be executed during this time.
Item – Executed for each item prepared in previous execution. Only logic elements with element context “Item” will be executed during this time.
Summary – Post-processes the calculated items. Only logic elements with element context “Item” will be executed during this time.
Information provided to the logic for executions:
Init
binding variable
model
(of type ModelParallelCalculationFormulaInitContext ) - includes Model Tables, inputs from previous steps and outputs from previous calculations, as with a simple calculation. The model is augmented with methods to create items to be calculated.
Item
binding variable
model
(of another type ModelParallelCalculationFormulaItemContext ) - includes Model Tables, inputs from previous steps and outputs from previous calculations, as with an evaluation (as it is a read-only context). The model is augmented with methods to access the item inputs.
Summary
binding variable
model
(of yet another type ModelParallelCalculationFormulaSummaryContext ) includes Model Tables, inputs from previous steps and outputs from previous calculations, as with a simple calculation. The model is augmented with methods to access the calculated items inputs and outputs.
Common actions done by the logic
Init
Can also do everything a simple calculation can do, except starting Job Trigger Calculations.
A failure of this step means a failure of the whole calculation.
Item
Can do everything an evaluation can do, i.e., everything is executed in read-only mode.
A failure of one item will NOT prevent other items to run nor the summary to run, but the whole calculation will still be considered as failed.
See also https://pricefx.atlassian.net/wiki/spaces/KB/pages/3862691915/Model+Object+MO#Calculation-Items.
Summary
Can also do everything a simple calculation can do.
A failure of this step means a failure of the whole calculation.
Expected logic execution outcome:
specific goals per execution type
Init - creates items to be attached to the calculation of parallel calculation
Item - calculates values for the item and provides them via output value of an element
Summary - calculates summary of the items and provides them via output value of an element