From 790fc5cc9fa8c7c0d92ebf0ae0a46f5214392997 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti Date: Mon, 18 Mar 2024 14:14:37 +0100 Subject: [PATCH 01/15] [Fix #599] Add python documentation --- serverlessworkflow/modules/ROOT/nav.adoc | 1 + .../pages/core/custom-functions-support.adoc | 4 + .../integrations/custom-functions-python.adoc | 116 ++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc diff --git a/serverlessworkflow/modules/ROOT/nav.adoc b/serverlessworkflow/modules/ROOT/nav.adoc index f4e96b381..0daa1601b 100644 --- a/serverlessworkflow/modules/ROOT/nav.adoc +++ b/serverlessworkflow/modules/ROOT/nav.adoc @@ -131,6 +131,7 @@ *** Integrations of external services **** xref:use-cases/advanced-developer-use-cases/integrations/camel-routes-integration.adoc[] **** xref:use-cases/advanced-developer-use-cases/integrations/custom-functions-knative.adoc[] +**** xref:use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc[] **** xref:use-cases/advanced-developer-use-cases/integrations/expose-metrics-to-prometheus.adoc[] **** xref:use-cases/advanced-developer-use-cases/integrations/serverless-dashboard-with-runtime-data.adoc[] *** Testing diff --git a/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc b/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc index 6bbbee125..9afe0d69d 100644 --- a/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc +++ b/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc @@ -300,6 +300,10 @@ The Camel route is responsible to produce the return value in a way that the wor include::../../pages/_common-content/camel-valid-responses.adoc[] +[[con-func-python] +== Python custom function +{product_name} provides an implementation of a custom function to execute embedded Python scripts and functions. See xref:use-cases/advanced-developer-use-cases/integrations/custom-functions-knative.adoc[Invoking Python from {product_name}] + [[con-func-knative]] == Knative custom function diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc new file mode 100644 index 000000000..eaf025b1e --- /dev/null +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -0,0 +1,116 @@ += Invoking Python from {product_name} +:compat-mode!: +// Metadata: +:description: Describe Python execution capabilities +:keywords: kogito, workflow, quarkus, serverless, python, AI + +This document describes how to integrate python scripts and function into you workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test. + +== Enable Python support + + To enable Python support you need to the python add-on dependency to your {prouct_name} module `pom.xml` file + +[source,xml] +---- + + org.apache.kie.sonataflow + sonataflow-addons-quarkus-python + +---- + +== Invoking embedded Python script. + +{product_name} supports of execution python script in the same memory address than the running workflow. + +To invoke a python script the first step is to define a custom python function at the beginning of the flow. + +[source,json] +---- + "functions": [ + { + "name": "python", + "type": "custom", + "operation": "script:python" + } + ] +---- + +Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. + +[source,json] +---- +"functionRef": + "name" : "Imports", + "refName": "python", + "arguments": { + "script": "import numpy as np" + } + } +---- + +Previous snippet imports link:https://numpy.org/[numpy] library. The same python function can be invoked again to generate an array containing three random numbers between 0 and 10. + +[source,json] +---- +"functionRef": { + "refName": "python", + "arguments": { + "script": "rng = np.random.default_rng().integers(low=0,high=10,size=3)" + } + } +---- + +To access the result of the embedded python invocation, {product_name} provides an special context variable: `$WORKFLOW.python`. Therefore, if you want to set `rng` variable from previous script as `output` property of the workflow model, you write + +[source,json] +---- +"stateDataFilter" : { + "output" : "{result:$WORKFLOW.python.rng}" +} +---- + +== Invoking Python function. + +You can also invoke functions from standard or custom python modules. + +You need to define a serverless workflow function definition that invokes the python function. You should specific, within `operation` property, the name of the python module and function to be invoked when the function is called. You should separate the module name and the function name using `::` and prefix them with `services::python:` + +The following example defines a function that invokes standard python function link:https://www.geeksforgeeks.org/python-math-factorial-function/[math.factorial(x)] +[source,json] +---- + "functions" : [ { + "name" : "factorial", + "operation" : "service:python:math::factorial", + "type" : "custom" + } +---- + +Once you have defined the function, you might call it passing the expected arguments. In the case of factorial, a integer stored in property `x` of the workflow model. + +[source,json] +---- + "functionRef" : { + "refName": "factorial", + "arguments" : ".x" + } +---- + +The return value of the function can be handled as any other function result using `actionDataFilter.toStateData` Serverless Workflow construct. The following will set a workflow model property called `result` with the factorial invocation returned value. + +[source,json] +---- + "actionDataFilter" : { + "toStateData" : ".result" + } +---- + +== Further reading + +The link:{kogito_sw_examples_url}/serverless-workflow-openvino-quarkus[Openvino] illustrates the powerful AI capabilities of integrating workflows with Python. It is a must seen for all interested on the topic. + +== Additional resources + +* xref:core/custom-functions-support.adoc[Custom functions for your {product_name} service] +* xref:core/understanding-jq-expressions.adoc[Understanding JQ expressions] + +include::../../../_common-content/report-issue.adoc[] \ No newline at end of file From 2bda032f4a8fd7585af25e20b696413a1ce8d763 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Tue, 19 Mar 2024 12:51:29 +0100 Subject: [PATCH 02/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gonzalo Muñoz --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index eaf025b1e..77f5c1518 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -4,7 +4,7 @@ :description: Describe Python execution capabilities :keywords: kogito, workflow, quarkus, serverless, python, AI -This document describes how to integrate python scripts and function into you workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test. +This document describes how to integrate python scripts and functions into your workflow using {product_name} custom functions. The code appearing in this document is copied from link:{kogito_sw_examples_url}/serverless-workflow-python-quarkus[`serverless-workflow-python-quarkus`] example application and link:{kogito_runtimes_url}/quarkus/addons/python/integration-tests/src/main/resources/PythonService.sw.json[PythonService] integration test. == Enable Python support From c814691b926d538bec196832cf49e43aa3f3f674 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Tue, 19 Mar 2024 12:51:37 +0100 Subject: [PATCH 03/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gonzalo Muñoz --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index 77f5c1518..40293d2fd 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -8,7 +8,7 @@ This document describes how to integrate python scripts and functions into your == Enable Python support - To enable Python support you need to the python add-on dependency to your {prouct_name} module `pom.xml` file + To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file [source,xml] ---- From 2105db97c2fddd314a6d7decbb898af5ad7d810e Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti Date: Tue, 19 Mar 2024 12:53:30 +0100 Subject: [PATCH 04/15] [Fix #599] Gonzalos comments --- .../integrations/custom-functions-python.adoc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index 40293d2fd..29d2af68f 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -40,8 +40,7 @@ Once done, you can use that function several times to execute arbitrary python c [source,json] ---- "functionRef": - "name" : "Imports", - "refName": "python", + "refName": "python", "arguments": { "script": "import numpy as np" } From f75c5ffba5b9eaafd685f39b4114d7f990168f6c Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:12:51 +0100 Subject: [PATCH 05/15] Update serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../modules/ROOT/pages/core/custom-functions-support.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc b/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc index 9afe0d69d..706ac7cc5 100644 --- a/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc +++ b/serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc @@ -302,7 +302,7 @@ include::../../pages/_common-content/camel-valid-responses.adoc[] [[con-func-python] == Python custom function -{product_name} provides an implementation of a custom function to execute embedded Python scripts and functions. See xref:use-cases/advanced-developer-use-cases/integrations/custom-functions-knative.adoc[Invoking Python from {product_name}] +{product_name} implements a custom function to execute embedded Python scripts and functions. See xref:use-cases/advanced-developer-use-cases/integrations/custom-functions-knative.adoc[Invoking Python from {product_name}] [[con-func-knative]] == Knative custom function From c57c47fa2940b78bc080914e1f3cbdbbb97a5845 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:13:01 +0100 Subject: [PATCH 06/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index 29d2af68f..4b77750c2 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -8,7 +8,7 @@ This document describes how to integrate python scripts and functions into your == Enable Python support - To enable Python support, you need to the python add-on dependency to your {prouct_name} module `pom.xml` file + To enable Python support, you must add the Python add-on dependency to your {prouct_name} module `pom.xml` file [source,xml] ---- From 0b7acbaa1737eecb5c9d859608dabc4dfb7dac26 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:13:14 +0100 Subject: [PATCH 07/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index 4b77750c2..dc757bc17 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -20,7 +20,7 @@ This document describes how to integrate python scripts and functions into your == Invoking embedded Python script. -{product_name} supports of execution python script in the same memory address than the running workflow. +{product_name} supports the execution of Python script in the same memory address as the running workflow. To invoke a python script the first step is to define a custom python function at the beginning of the flow. From 8ec0132d15b8213fec07b4e06be490084235a589 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:13:22 +0100 Subject: [PATCH 08/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index dc757bc17..6d9fa6fd7 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -22,7 +22,7 @@ This document describes how to integrate python scripts and functions into your {product_name} supports the execution of Python script in the same memory address as the running workflow. -To invoke a python script the first step is to define a custom python function at the beginning of the flow. +To invoke a Python script the first step is to define a custom Python function at the beginning of the flow. [source,json] ---- From 2f5a971333cc705ca157a00866f21b70f1e42605 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:53:35 +0100 Subject: [PATCH 09/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index 6d9fa6fd7..33f8a5220 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -47,7 +47,7 @@ Once done, you can use that function several times to execute arbitrary python c } ---- -Previous snippet imports link:https://numpy.org/[numpy] library. The same python function can be invoked again to generate an array containing three random numbers between 0 and 10. +Previous snippet imports link:https://numpy.org/[numpy] library. The same Python function can be invoked again to generate an array containing three random numbers between `0` and `10`. [source,json] ---- From 9afcd230b4ef1cd1579747ce992bfb874ae94aac Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:53:42 +0100 Subject: [PATCH 10/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index 33f8a5220..898ed227f 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -59,7 +59,7 @@ Previous snippet imports link:https://numpy.org/[numpy] library. The same Python } ---- -To access the result of the embedded python invocation, {product_name} provides an special context variable: `$WORKFLOW.python`. Therefore, if you want to set `rng` variable from previous script as `output` property of the workflow model, you write +To access the result of the embedded python invocation, {product_name} provides a special context variable: `$WORKFLOW.python`. Therefore, if you want to set the `rng` variable from the previous script as the `output` property of the workflow model, you write [source,json] ---- From c6e588c6ef0c60c031e95c97c551348243f23f53 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:53:57 +0100 Subject: [PATCH 11/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index 898ed227f..2eee1c2ee 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -35,7 +35,7 @@ To invoke a Python script the first step is to define a custom Python function a ] ---- -Once done, you can use that function several times to execute arbitrary python code. The python code is provided as argument of the function call through `script` property. +Once done, you can use that function several times to execute arbitrary Python code. The Python code is provided as an argument of the function call through the `script` property. [source,json] ---- From 768c32500adb5ec77edd9f2d3a87fd5b1b617cc4 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:54:13 +0100 Subject: [PATCH 12/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index 2eee1c2ee..075bb38f3 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -72,7 +72,7 @@ To access the result of the embedded python invocation, {product_name} provides You can also invoke functions from standard or custom python modules. -You need to define a serverless workflow function definition that invokes the python function. You should specific, within `operation` property, the name of the python module and function to be invoked when the function is called. You should separate the module name and the function name using `::` and prefix them with `services::python:` +You must define a serverless workflow function definition that invokes the Python function. You should specify, within the `operation` property, the name of the Python module and function to be invoked when the function is called. You should separate the module name and the function name using `::` and prefix them with `services::python:` The following example defines a function that invokes standard python function link:https://www.geeksforgeeks.org/python-math-factorial-function/[math.factorial(x)] [source,json] From 33ce8cbb73b18e391dcad6a9ef389b2d145dd8e1 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:54:23 +0100 Subject: [PATCH 13/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index 075bb38f3..0b91c72a9 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -74,7 +74,7 @@ You can also invoke functions from standard or custom python modules. You must define a serverless workflow function definition that invokes the Python function. You should specify, within the `operation` property, the name of the Python module and function to be invoked when the function is called. You should separate the module name and the function name using `::` and prefix them with `services::python:` -The following example defines a function that invokes standard python function link:https://www.geeksforgeeks.org/python-math-factorial-function/[math.factorial(x)] +The following example defines a function that invokes a standard Python function link:https://www.geeksforgeeks.org/python-math-factorial-function/[math.factorial(x)] [source,json] ---- "functions" : [ { From bfbdcbd17ae5ac804c757d7ec1e66b7fea3765df Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:54:32 +0100 Subject: [PATCH 14/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index 0b91c72a9..c5eafe2ee 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -94,7 +94,7 @@ Once you have defined the function, you might call it passing the expected argum } ---- -The return value of the function can be handled as any other function result using `actionDataFilter.toStateData` Serverless Workflow construct. The following will set a workflow model property called `result` with the factorial invocation returned value. +The return value of the function can be handled as any other function result using the `actionDataFilter.toStateData` Serverless Workflow construct. The following will set a workflow model property called `result` with the factorial invocation returned value. [source,json] ---- From 865351511c283ed5ee34ad6c1debc48fbc8c54c1 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti <65240126+fjtirado@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:54:45 +0100 Subject: [PATCH 15/15] Update serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc Co-authored-by: Kalyani Desai <43639538+kaldesai@users.noreply.github.com> --- .../integrations/custom-functions-python.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc index c5eafe2ee..c22ce81e8 100644 --- a/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc +++ b/serverlessworkflow/modules/ROOT/pages/use-cases/advanced-developer-use-cases/integrations/custom-functions-python.adoc @@ -105,7 +105,7 @@ The return value of the function can be handled as any other function result usi == Further reading -The link:{kogito_sw_examples_url}/serverless-workflow-openvino-quarkus[Openvino] illustrates the powerful AI capabilities of integrating workflows with Python. It is a must seen for all interested on the topic. +The link:{kogito_sw_examples_url}/serverless-workflow-openvino-quarkus[Openvino] illustrates the powerful AI capabilities of integrating workflows with Python. It is a must-see for all interested in the topic. == Additional resources