aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-03-23 17:49:50 +0000
committerliamfallon <liam.fallon@est.tech>2020-03-24 17:40:27 +0000
commit2f75e9d08d1e47e2b9b39ec21653bc3b4d65d00a (patch)
treebe5374421d8b3f026175ab51d197289ea9dbbe0d /examples
parentf7746d758149bc68584c01dc0fe15130c7a866b1 (diff)
Launch separate threads for Javascript task execution
When a policy is loaded, a separate thread is spawned for each Javascript script executor. This allows us to precompile the Javascript scripts and also to have a larger stack available for script execution. Issue-ID: POLICY-2106 Change-Id: I97323aafb623ba537ac1889b3c9504b345b4f67e Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'examples')
-rw-r--r--examples/examples-decisionmaker/src/main/resources/logic/MakeDecisionStateTSL.js6
-rw-r--r--examples/examples-decisionmaker/src/main/resources/policy/DecisionMakerPolicyModel.apex26
2 files changed, 16 insertions, 16 deletions
diff --git a/examples/examples-decisionmaker/src/main/resources/logic/MakeDecisionStateTSL.js b/examples/examples-decisionmaker/src/main/resources/logic/MakeDecisionStateTSL.js
index 33af49534..e49438d14 100644
--- a/examples/examples-decisionmaker/src/main/resources/logic/MakeDecisionStateTSL.js
+++ b/examples/examples-decisionmaker/src/main/resources/logic/MakeDecisionStateTSL.js
@@ -34,9 +34,9 @@ else if (executor.inFields.get("mode").equals("optimistic")) {
else if (executor.inFields.get("mode").equals("dithering")) {
executor.subject.getTaskKey("DitheringAnswerTask").copyTo(executor.selectedTask);
}
-//else if (executor.inFields.get("mode").equals("roundrobin")) {
-// executor.subject.getTaskKey("RoundRobinAnswerTask").copyTo(executor.selectedTask);
-//}
+else if (executor.inFields.get("mode").equals("roundrobin")) {
+ executor.subject.getTaskKey("RoundRobinAnswerTask").copyTo(executor.selectedTask);
+}
executor.logger.info("Answer Selected Task:" + executor.selectedTask);
diff --git a/examples/examples-decisionmaker/src/main/resources/policy/DecisionMakerPolicyModel.apex b/examples/examples-decisionmaker/src/main/resources/policy/DecisionMakerPolicyModel.apex
index 295afa159..672ff894f 100644
--- a/examples/examples-decisionmaker/src/main/resources/policy/DecisionMakerPolicyModel.apex
+++ b/examples/examples-decisionmaker/src/main/resources/policy/DecisionMakerPolicyModel.apex
@@ -113,18 +113,18 @@ task logic create name=DitheringAnswerTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/DitheringAnswerTask.js"
LE
-#task create name=RoundRobinAnswerTask
-#
-#task inputfield create name=RoundRobinAnswerTask fieldName=mode schemaName=SimpleStringType
-#
-#task outputfield create name=RoundRobinAnswerTask fieldName=decision schemaName=SimpleStringType
-#
-#task contextref create name=RoundRobinAnswerTask albumName=AnswerAlbum
-#task contextref create name=RoundRobinAnswerTask albumName=LastAnswerAlbum
-#
-#task logic create name=RoundRobinAnswerTask logicFlavour=JAVASCRIPT logic=LS
-##MACROFILE:"src/main/resources/logic/RoundRobinAnswerTask.js"
-#LE
+task create name=RoundRobinAnswerTask
+
+task inputfield create name=RoundRobinAnswerTask fieldName=mode schemaName=SimpleStringType
+
+task outputfield create name=RoundRobinAnswerTask fieldName=decision schemaName=SimpleStringType
+
+task contextref create name=RoundRobinAnswerTask albumName=AnswerAlbum
+task contextref create name=RoundRobinAnswerTask albumName=LastAnswerAlbum
+
+task logic create name=RoundRobinAnswerTask logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/logic/RoundRobinAnswerTask.js"
+LE
policy create name=AnswerInitPolicy template=freestyle firstState=AnswerInitState
@@ -140,7 +140,7 @@ policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState
policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState taskName=PessimisticAnswerTask outputType=DIRECT outputName=DecisionFinalOutput
policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState taskName=OptimisticAnswerTask outputType=DIRECT outputName=DecisionFinalOutput
policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState taskName=DitheringAnswerTask outputType=DIRECT outputName=DecisionFinalOutput
-#policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState taskName=RoundRobinAnswerTask outputType=DIRECT outputName=DecisionFinalOutput
+policy state taskref create name=DecisionMakerPolicy stateName=MakeDecisionState taskName=RoundRobinAnswerTask outputType=DIRECT outputName=DecisionFinalOutput
policy state selecttasklogic create name=DecisionMakerPolicy stateName=MakeDecisionState logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/MakeDecisionStateTSL.js"