Class Simulation
- All Implemented Interfaces:
Calculable,HasCalculableObjectItems,JobNameProvider,JobSettingsProvider,UserGroupRestrictedObject
SIM) is a what-if test of an existing Pricelist or PriceGrid: it recalculates the base document's items into its own line items, without changing the base document. It uses the same logic names as the base document, but each logic, Company Parameter table (read via api.vLookup or a BoM) and Manual Price List can resolve to a Simulation Only version. When several versions with the same name exist, the one with the newest Valid From (not after the target date) wins; at an equal Valid From an Active version wins over a Simulation Only one. Simulation Only versions are further limited by getSimulationSet().
A Simulation logic calculates one line item at a time (api.currentItem() returns the SimulationItem); the Simulation header is not passed to it as an object. The self binding holds baseCO and baseCOType, plus basePricelistId and basePricelistType for a Simulation based on a Price List. api.contextTypedId() returns the Simulation's typed id, while api.contextName() returns the base document's label and api.previousContext(sku) reads the base document's items.
To read a Simulation from a logic, use api.findSimulations(targetDate, name); api.getSimulationSummaryQuery() reads its summary, and CalculationFlowActionBuilder#addSimulationAction(label).setCalculate(true) calculates it from a Calculation Flow. Line items have the type code SIMI (XSIMI for a Matrix base document, see getBaseCOType()) and reference their Simulation by the simulationId field.
A Simulation based on a Price List can be converted into a new Price List (not approved yet) in the UI or via the REST command simulationmanager.convert2pl; there is no api.* call for it.
Example, looking up the Simulations based on a specific Price List:
def sims = api.find("SIM", 0, 0, null, ["id", "label", "baseCO"], Filter.equal("baseCO", "123.PL"))
def sim = sims ? sims[0] : null
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe kind of document a Simulation is based on, as classified bybaseCalculableType().Nested classes/interfaces inherited from class MatrixableCalculableObject
MatrixableCalculableObject.ListTypeNested classes/interfaces inherited from class PersistedObject
PersistedObject.BatchDelete, PersistedObject.BulkloadFilterCheckCallback, PersistedObject.ComputedFieldMapping, PersistedObject.ComputedFields, PersistedObject.HardDelete, PersistedObject.ImportManagerEnabled, PersistedObject.PersistedObjectMeta, PersistedObject.VirtualField, PersistedObject.VirtualFieldMapping, PersistedObject.VirtualFields, PersistedObject.VirtualSearchFields, PersistedObject.VirtualSortFields -
Field Summary
Fields inherited from class AbstractCalculable
FIELD_CALCDATE, FIELD_CALCMESSAGES, FIELD_CALCSTARTDATE, FIELD_STATUS, MAX_CALCULATION_MESSAGE_LENGTH, MAX_CALCULATION_MESSAGE_THRESHOLDFields inherited from class PartitionedObject
FIELD_PARTITION, FIELD_PARTITIONID, PARTITION_FILTER_NAME, PARTITION_FILTER_PARAMFields inherited from class PersistedObject
FIELD_CREATEDATE, FIELD_CREATEDBY, FIELD_DELETEDATE, FIELD_DELETEDBY, FIELD_ID, FIELD_ISDELETED, FIELD_LASTUPDATEBY, FIELD_LASTUPDATEDATE, FIELD_VERSIONFields inherited from interface UserGroupRestrictedObject
FIELD_USERGROUPEDIT, FIELD_USERGROUPVIEWDETAILS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClassifiesgetBaseCO()as based on a Price List or a Price Grid.MatrixableCalculableObject.ListTypeWhether the base document is a plain, per-SKU document or a Matrix one with an extra dimension.The id of thePriceGridthis Simulation is based on, derived fromgetBaseCO()(not from the value last passed tosetBasePriceGridId(Long): that setter only stages a value forvalidate(ValidationVisitor, PersistedObjectService)to fold intogetBaseCO(), it does not change what this getter returns until validation has run).The id of thePricelistthis Simulation is based on, derived fromgetBaseCO()(not from the value last passed tosetBasePricelistId(Long): that setter only stages a value forvalidate(ValidationVisitor, PersistedObjectService)to fold intogetBaseCO(), it does not change what this getter returns until validation has run).Intended to hold the typed id of the base document used by the last calculation, so that a change ofgetBaseCO()can be detected on the next run.JobStatusTracker.TrackerTypeThe kind of background job tracker used by default when this Simulation's calculation runs.For a Matrix Simulation, whether to calculate every secondary key (key2) returned by the matrix logic.Class<? extends ElementAttributeMeta> The attribute-metadata type describing extension/attribute metadata for this Simulation's line items.Class<? extends AbstractSimulationItem> The concrete line item type backing this Simulation's items:SimulationItemfor a plain, per-SKU base document,MatrixSimulationItemfor a Matrix base document (seegetBaseCOType()).static Class<? extends AbstractSimulationItem> getItemClassS(MatrixableCalculableObject.ListType type) The concrete line item type for a Simulation of the given list type.Equivalent togetItemListFilterFieldS(): the entity field name used to look up this Simulation's line items.static StringThe field on a line item (SIMI/XSIMI) that references its Simulation, for exampleapi.find("SIMI", 0, 0, null, ["sku"], Filter.equal("simulationId", simulationId)).The job-type discriminator used for background calculation job naming/routing.MatrixableCalculableObject.ListTypeEquivalent togetBaseCOType().intgetShotgunThreshold(PersistedObjectService objService, JobStatusTracker jst) The minimum job size (seejobSize(PersistedObjectService, JobStatusTracker, int)) above which the calculation framework switches into shotgun (distributed) mode instead of a single sequential run, whenisShotgunEnabled(PersistedObjectService)allows it.The Simulation Set that selects which Simulation Only logics, Company Parameter tables and Manual Price Lists this Simulation may use: only those with the same Simulation Set, or with none, are considered.The ids of the Simulation Only logics (PricingFormula) used by this Simulation's calculation, recorded by the calculation.The ids of the Simulation Only Company Parameter tables (LookupTable) read viaapi.vLookupor a BoM by this Simulation's calculation, recorded by the calculation.booleanWhether, for a Price-List-based Simulation, the item set to calculate should be re-derived from the base Price List's product filter criteria rather than reusing the base Price List's existing items.The User Group(s) whose members may edit and delete this Simulation.The User Group(s) whose members may view this Simulation's details.booleanisMatrix()A shorthand forListType.MATRIX.equals(getBaseCOType()), useful where a full switch overgetBaseCOType()is not needed.booleanisShotgunEnabled(PersistedObjectService txn) Whether "shotgun mode" (distributed calculation spread across multiple worker agents/pods rather than run sequentially) is allowed for this Simulation at all.booleanWhether "shotgun mode" (distributed calculation spread across multiple worker agents/pods rather than run sequentially) is enabled for this Simulation.intjobSize(PersistedObjectService objectService, JobStatusTracker tracker, int runNumber) The size of this Simulation's current calculation run: the number of line items the run is expected to process.voidSets the Price List or Price Grid this Simulation is based on.voidsetBaseCOType(MatrixableCalculableObject.ListType baseCOType) Sets the list type of the base document.voidsetBasePriceGridId(Long basePriceGridId) Stages the given id as this Simulation's base Price Grid.voidsetBasePricelistId(Long basePricelistId) Stages the given id as this Simulation's base Price List.voidsetCalculatedBaseTypedId(String calculatedBaseTypedId) Records the typed id of the base document used by the last calculation (seegetCalculatedBaseTypedId()).voidsetIgnoreSecKeyFiltering(Boolean ignoreSecKeyFiltering) Sets whether to calculate every secondary key returned by the matrix logic (seegetIgnoreSecKeyFiltering()).voidsetShotgunModeEnabled(Boolean shotgunModeEnabled) Sets whether shotgun (distributed) mode is enabled for this Simulation.voidsetSimulationSet(String simulationSet) Sets the Simulation Set (seegetSimulationSet()).voidsetUsedSimulationFormulas(Set<Long> usedSimulationFormulas) Records the Simulation Only logics used by this Simulation's calculation (seegetUsedSimulationFormulas()).voidsetUsedSimulationLookups(Set<Long> usedSimulationLookups) Records the Simulation Only Company Parameter tables used by this Simulation's calculation (seegetUsedSimulationLookups()).voidsetUseFilterCriteria(Boolean useFilterCriteria) Sets whether the items of a Price List based Simulation are selected by the base Price List's product filter.voidsetUserGroupEdit(String userGroup) Sets the User Group(s) whose members may edit and delete this Simulation (seegetUserGroupEdit()).voidsetUserGroupViewDetails(String userGroup) Sets the User Group(s) whose members may view this Simulation's details (seegetUserGroupViewDetails()).booleanvalidate(ValidationVisitor validationVisitor, PersistedObjectService objService) Validates this Simulation before it is saved, in addition to the base validation of the superclass.Methods inherited from class MatrixableCalculableObject
anyToRecalculationMethods inherited from class CalculableObject
getEffectiveTargetDate, getKeepManualOverrides, getNumberOfItems, getWriteOnlyChangedItems, itemsStateChanged, setKeepManualOverrides, setNumberOfItems, setWriteOnlyChangedItemsMethods inherited from class AbstractCalculable
calculationDate, calculationStartDate, getCalculationConcurrencyKey, getCalculationDate, getCalculationMessages, getCalculationMessagesAsList, getCalculationStartDate, getJobName, getLabel, getLocale, getStatus, getTargetDate, isAnonymousCalculable, setCalculationDate, setCalculationMessages, setCalculationMessages, setCalculationStartDate, setLabel, setLocale, setStatus, setTargetDateMethods inherited from class PartitionedObject
addUniqueConstraint, getLoginNameByUserId, getPartition, setPartition, toStringMethods inherited from class PersistedObject
auditOperation, bumpVersion, canAdd, canDelete, canEdit, canEdit, canRead, canReadElements, createDate, entityIsHardDeleted, entityIsMassDeletable, entityIsSafeInserted, entityIsSafeInserted, getBulkloadMap, getBusinessKey, getCreateDate, getCreatedBy, getDbColumnNameForField, getDeleteDate, getDeletedBy, getId, getLastUpdateBy, getLastUpdateDate, getSensitiveFields, getSignificantFields, getTypeCode, getTypedId, getVersion, getVirtualSearchFieldMappings, getVirtualSortFieldMappings, isAudited, isDeleted, isHardDeleted, isVirtualSearchField, lastUpdateDate, notifyOnBusinessKeyChange, onBusinessKeyChange, onDelete, onRefreshed, onSavedOrUpdated, onSaveOrUpdate, setCreateDate, setCreateDateShouldBeIgnored, setCreateDateTime, setCreatedBy, setDeleted, setDeleteDate, setDeletedBy, setId, setLastUpdateBy, setLastUpdateDate, setLastUpdateDateTime, setTypedId, setVersion, userGroupEditBulkloadFilter, userGroupEditBulkloadFilterMethods inherited from class DomainObject
deepCopy, getNewMidnightDate, getNewMidnightDateTime, isMidnight, isMidnight, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonDeserialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerialize, jsonSerializedSizeOK, jsonSerializeToBytes, jsonSerializeToBytes, setToDayEnd, setToDayEnd, setToMidnight, setToMidnight, setToMidnightAsLocalDateTime, toPropertyMap, truncatedToStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface JobSettingsProvider
getAgentOption1
-
Constructor Details
-
Simulation
public Simulation()
-
-
Method Details
-
getBasePricelistId
The id of thePricelistthis Simulation is based on, derived fromgetBaseCO()(not from the value last passed tosetBasePricelistId(Long): that setter only stages a value forvalidate(ValidationVisitor, PersistedObjectService)to fold intogetBaseCO(), it does not change what this getter returns until validation has run).Note:
basePricelistIdis not a stored field; it is derived frombaseCO. Filtering on it withapi.findorapi.streamthrowsIllegalStateException; filter ongetBaseCO()instead, for exampleFilter.equal("baseCO", "123.PL").- Returns:
- The base Price List's id, or
nullif this Simulation is based on a Price Grid instead. - Throws:
UnsupportedOperationException- ViabaseCalculableType(), ifgetBaseCO()does not identify aPricelistorPriceGrid.
-
getBasePriceGridId
The id of thePriceGridthis Simulation is based on, derived fromgetBaseCO()(not from the value last passed tosetBasePriceGridId(Long): that setter only stages a value forvalidate(ValidationVisitor, PersistedObjectService)to fold intogetBaseCO(), it does not change what this getter returns until validation has run).Note:
basePriceGridIdis not a stored field; it is derived frombaseCO. Filtering on it withapi.findorapi.streamthrowsIllegalStateException; filter ongetBaseCO()instead, for exampleFilter.equal("baseCO", "123.PG").- Returns:
- The base Price Grid's id, or
nullif this Simulation is based on a Price List instead. - Throws:
UnsupportedOperationException- ViabaseCalculableType(), ifgetBaseCO()does not identify aPricelistorPriceGrid.
-
setBasePriceGridId
Stages the given id as this Simulation's base Price Grid. Has no effect ongetBasePriceGridId()orgetBaseCO()by itself; takes effect only the next timevalidate(ValidationVisitor, PersistedObjectService)runs, which folds it intogetBaseCO()as"<id>.PG".- Parameters:
basePriceGridId- The id of the Price Grid to base this Simulation on.
-
setBasePricelistId
Stages the given id as this Simulation's base Price List. Has no effect ongetBasePricelistId()orgetBaseCO()by itself; takes effect only the next timevalidate(ValidationVisitor, PersistedObjectService)runs, which folds it intogetBaseCO()as"<id>.PL".- Parameters:
basePricelistId- The id of the Price List to base this Simulation on.
-
getBaseCO
The typed id (for example"123.PL"or"123.PG") of thePricelistorPriceGridthis Simulation is based on. This is the fieldgetBasePricelistId()andgetBasePriceGridId()are derived from, and the one to filter on directly from a calculation logic (see the note on those getters).- Returns:
- The base document's typed id.
-
setBaseCO
Sets the Price List or Price Grid this Simulation is based on.- Parameters:
baseCO- The typed id (for example"123.PL"or"123.PG") of the Price List or Price Grid to base this Simulation on.
-
getBaseCOType
public MatrixableCalculableObject.ListType getBaseCOType()Whether the base document is a plain, per-SKU document or a Matrix one with an extra dimension. This also determines the line item type returned bygetItemClass().- Returns:
- The base document's list type. Defaults to
ListType.SIMPLEwhen none has been set.
-
setBaseCOType
public void setBaseCOType(MatrixableCalculableObject.ListType baseCOType) Sets the list type of the base document. Every calculation overwrites it with the base document's current list type, so a value set by hand does not last.- Parameters:
baseCOType- The list type of the base document (plain or Matrix).
-
baseCalculableType
ClassifiesgetBaseCO()as based on a Price List or a Price Grid.- Returns:
Simulation.SimulationType.PriceListorSimulation.SimulationType.PriceGrid.- Throws:
UnsupportedOperationException- IfgetBaseCO()does not identify aPricelistorPriceGrid.
-
getListType
public MatrixableCalculableObject.ListType getListType()Equivalent togetBaseCOType().- Overrides:
getListTypein classMatrixableCalculableObject- Returns:
- The base document's list type. Defaults to
ListType.SIMPLEwhen none has been set.
-
getCalculatedBaseTypedId
Intended to hold the typed id of the base document used by the last calculation, so that a change ofgetBaseCO()can be detected on the next run. Currently the calculation does not populate it, so it is normallynull. Not meant to be used directly in Groovy.- Returns:
- The base document's typed id recorded for the last calculation, normally
null.
-
setCalculatedBaseTypedId
Records the typed id of the base document used by the last calculation (seegetCalculatedBaseTypedId()). Not meant to be used directly in Groovy.- Parameters:
calculatedBaseTypedId- The base document's typed id to record for the last calculation.
-
getSimulationSet
The Simulation Set that selects which Simulation Only logics, Company Parameter tables and Manual Price Lists this Simulation may use: only those with the same Simulation Set, or with none, are considered. Whennull, only Simulation Only elements without a Simulation Set are used.- Returns:
- The Simulation Set name, or
nullif none is assigned.
-
setSimulationSet
Sets the Simulation Set (seegetSimulationSet()).- Parameters:
simulationSet- The Simulation Set name to assign, ornullto use only Simulation Only elements without a Simulation Set.
-
getUsedSimulationFormulas
The ids of the Simulation Only logics (PricingFormula) used by this Simulation's calculation, recorded by the calculation. When the Simulation is converted into a Price List with object conversion enabled, these logics are switched to Active. Not meant to be used directly in Groovy.- Returns:
- The set of used logic ids, or
nullif none are recorded.
-
setUsedSimulationFormulas
Records the Simulation Only logics used by this Simulation's calculation (seegetUsedSimulationFormulas()). Not meant to be used directly in Groovy.- Parameters:
usedSimulationFormulas- The ids of the Simulation Only logics used, ornullto clear the set.
-
getUsedSimulationLookups
The ids of the Simulation Only Company Parameter tables (LookupTable) read viaapi.vLookupor a BoM by this Simulation's calculation, recorded by the calculation. When the Simulation is converted into a Price List with object conversion enabled, these tables are switched to Active. Not meant to be used directly in Groovy.- Returns:
- The set of used Company Parameter table ids, or
nullif none are recorded.
-
setUsedSimulationLookups
Records the Simulation Only Company Parameter tables used by this Simulation's calculation (seegetUsedSimulationLookups()). Not meant to be used directly in Groovy.- Parameters:
usedSimulationLookups- The ids of the Simulation Only Company Parameter tables used, ornullto clear the set.
-
getUseFilterCriteria
public boolean getUseFilterCriteria()Whether, for a Price-List-based Simulation, the item set to calculate should be re-derived from the base Price List's product filter criteria rather than reusing the base Price List's existing items. Has no effect when the base document is a Price Grid.- Returns:
trueif the product filter criteria should be used to select items,falseotherwise (including when unset).
-
setUseFilterCriteria
Sets whether the items of a Price List based Simulation are selected by the base Price List's product filter.- Parameters:
useFilterCriteria- Whether to re-derive the item set from the base Price List's product filter criteria.
-
isShotgunModeEnabled
public boolean isShotgunModeEnabled()Whether "shotgun mode" (distributed calculation spread across multiple worker agents/pods rather than run sequentially) is enabled for this Simulation. Defaulted from the base document's own shotgun mode setting the first time this Simulation is validated (seevalidate(ValidationVisitor, PersistedObjectService)), and can be overridden afterwards.- Returns:
trueif shotgun mode is enabled,falseotherwise (including when unset).
-
setShotgunModeEnabled
Sets whether shotgun (distributed) mode is enabled for this Simulation.- Parameters:
shotgunModeEnabled- Whether shotgun mode should be enabled for this Simulation, ornullto let it be defaulted from the base document on the next validation.
-
getUserGroupEdit
The User Group(s) whose members may edit and delete this Simulation. Users with theUSERGROUP_OVERRIDEpermission bypass the restriction.- Specified by:
getUserGroupEditin interfaceUserGroupRestrictedObject- Returns:
- A User Group unique name or a comma-separated list of them, or
nullif editing is not restricted by User Group.
-
setUserGroupEdit
Sets the User Group(s) whose members may edit and delete this Simulation (seegetUserGroupEdit()).- Specified by:
setUserGroupEditin interfaceUserGroupRestrictedObject- Parameters:
userGroup- A User Group unique name or a comma-separated list of them, ornullto remove the restriction.
-
getUserGroupViewDetails
The User Group(s) whose members may view this Simulation's details. Members of the edit User Group(s) (getUserGroupEdit()) may view the details too, and users with theUSERGROUP_OVERRIDEpermission bypass the restriction.- Specified by:
getUserGroupViewDetailsin interfaceUserGroupRestrictedObject- Returns:
- A User Group unique name or a comma-separated list of them, or
nullif viewing is not restricted by User Group.
-
setUserGroupViewDetails
Sets the User Group(s) whose members may view this Simulation's details (seegetUserGroupViewDetails()).- Specified by:
setUserGroupViewDetailsin interfaceUserGroupRestrictedObject- Parameters:
userGroup- A User Group unique name or a comma-separated list of them, ornullto remove the restriction.
-
getIgnoreSecKeyFiltering
For a Matrix Simulation, whether to calculate every secondary key (key2) returned by the matrix logic. Whenfalse(the default), only the secondary keys that already exist for the SKU in the base document are calculated.- Returns:
trueif every secondary key returned by the matrix logic is calculated,false(also when unset) if they are limited to the base document's secondary keys.
-
setIgnoreSecKeyFiltering
Sets whether to calculate every secondary key returned by the matrix logic (seegetIgnoreSecKeyFiltering()).- Parameters:
ignoreSecKeyFiltering- Whether to calculate every secondary key returned by the matrix logic instead of only the base document's secondary keys, for a Matrix Simulation.
-
isMatrix
public boolean isMatrix()A shorthand forListType.MATRIX.equals(getBaseCOType()), useful where a full switch overgetBaseCOType()is not needed.- Overrides:
isMatrixin classMatrixableCalculableObject- Returns:
trueif the base document is a Matrix document,falseotherwise.
-
validate
public boolean validate(ValidationVisitor validationVisitor, PersistedObjectService objService) Validates this Simulation before it is saved, in addition to the base validation of the superclass. Folds a value staged viasetBasePriceGridId(Long)orsetBasePricelistId(Long)intogetBaseCO(); rejects agetBaseCO()that does not resolve to an existing calculable object (only Price List and Price Grid bases are supported by the calculation); and, when shotgun mode has never been set on this Simulation, copies the base document's shotgun mode setting. Not meant to be used directly in Groovy.- Overrides:
validatein classAbstractCalculable- Parameters:
validationVisitor- Receives a validation error on each of thebaseCO,basePriceGridId, andbasePricelistIdfields when the base document cannot be resolved. May benull, in which case errors are simply not recorded.objService- Used to resolvegetBaseCO()to its actual Price List or Price Grid, and to delegate to the superclass validation. Whennull, only the superclass validation runs.- Returns:
trueif this Simulation is valid,falseotherwise.
-
getItemClass
The concrete line item type backing this Simulation's items:SimulationItemfor a plain, per-SKU base document,MatrixSimulationItemfor a Matrix base document (seegetBaseCOType()). Used generically by item-management code to instantiate and query this Simulation's line items. Not meant to be used directly in Groovy.- Specified by:
getItemClassin interfaceHasCalculableObjectItems- Returns:
- The line item class corresponding to
getBaseCOType().
-
getItemClassS
public static Class<? extends AbstractSimulationItem> getItemClassS(MatrixableCalculableObject.ListType type) The concrete line item type for a Simulation of the given list type. Not meant to be used directly in Groovy.- Parameters:
type- The list type to resolve.- Returns:
SimulationItem.classforSIMPLE,MatrixSimulationItem.classforMATRIX.
-
getItemListFilterField
Equivalent togetItemListFilterFieldS(): the entity field name used to look up this Simulation's line items. Not meant to be used directly in Groovy.- Specified by:
getItemListFilterFieldin interfaceHasCalculableObjectItems- Returns:
"simulationId".
-
getItemListFilterFieldS
The field on a line item (SIMI/XSIMI) that references its Simulation, for exampleapi.find("SIMI", 0, 0, null, ["sku"], Filter.equal("simulationId", simulationId)). The method itself is not meant to be used directly in Groovy; use the field name"simulationId"instead.- Returns:
"simulationId".
-
getItemAttributeMetaClass
The attribute-metadata type describing extension/attribute metadata for this Simulation's line items.- Specified by:
getItemAttributeMetaClassin interfaceHasCalculableObjectItems- Returns:
SimulationItemAttributeMeta.class.
-
getDefaultTrackerType
public JobStatusTracker.TrackerType getDefaultTrackerType()The kind of background job tracker used by default when this Simulation's calculation runs. Not meant to be used directly in Groovy.- Specified by:
getDefaultTrackerTypein classAbstractCalculable- Returns:
TrackerType.SIMULATION.
-
getJobType
The job-type discriminator used for background calculation job naming/routing. Not meant to be used directly in Groovy.- Specified by:
getJobTypein interfaceJobSettingsProvider- Returns:
- This Simulation's type code,
"SIM".
-
isShotgunEnabled
public boolean isShotgunEnabled(PersistedObjectService txn) Whether "shotgun mode" (distributed calculation spread across multiple worker agents/pods rather than run sequentially) is allowed for this Simulation at all. Not meant to be used directly in Groovy.- Specified by:
isShotgunEnabledin interfaceJobSettingsProvider- Parameters:
txn- Unused by this implementation; present for theJobSettingsProvidercontract.- Returns:
isShotgunModeEnabled().
-
getShotgunThreshold
public int getShotgunThreshold(PersistedObjectService objService, JobStatusTracker jst) The minimum job size (seejobSize(PersistedObjectService, JobStatusTracker, int)) above which the calculation framework switches into shotgun (distributed) mode instead of a single sequential run, whenisShotgunEnabled(PersistedObjectService)allows it. The threshold is set for the whole instance (default 5000) and can be overridden per partition by an application property. Not meant to be used directly in Groovy.- Specified by:
getShotgunThresholdin interfaceJobSettingsProvider- Parameters:
objService- Used to resolve the configured threshold.jst- The job status tracker for the current calculation run.- Returns:
- The shotgun mode threshold for this run.
-
jobSize
public int jobSize(PersistedObjectService objectService, JobStatusTracker tracker, int runNumber) The size of this Simulation's current calculation run: the number of line items the run is expected to process. Used by the calculation framework both to decide whether to switch into shotgun (distributed) mode (compared againstgetShotgunThreshold(PersistedObjectService, JobStatusTracker)) and, once in shotgun mode, to size the number of worker pods. Not meant to be used directly in Groovy.Resolution order: the count of items already marked for recalculation, then, only if the tainted-recalculation flag is set, the count of tainted items, then, for a follow-up pass (
runNumber > 0), the count of dirty items, then the base document's own item count.- Specified by:
jobSizein interfaceJobSettingsProvider- Parameters:
objectService- Used to count line items and to look up the base document when the size cannot be resolved from the tracker.tracker- The job status tracker for the current calculation run, supplying job parameters.runNumber- The current pass number of a multi-pass calculation (0 for the first pass).- Returns:
- The number of line items this run is expected to process.
-