The purpose of this logic is the same as of the Model Calculation Logic. This article describes only logic API differences between this logic and the simple one.
The parallel calculation is executed in 3 steps which 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 the 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 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 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 simple calculation. The model is augmented with methods to access the calculated items inputs and outputs.
Common actions done by the logic:
Init
Can do everything a simple calculation can do, except for starting Job Trigger Calculations.
If this step fails, the whole calculation fails.
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 or the summary from running, 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 do everything a simple calculation can do.
If this step fails, the whole calculation fails.
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 the output value of an element.
Summary – Calculates summary of the items and provides them via the output value of an element.