This is an automated email from the ASF dual-hosted git repository.
fjtiradosarti pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-examples.git
The following commit(s) were added to refs/heads/main by this push:
new 0f60a3fc9 Updating broken python example (#2086)
0f60a3fc9 is described below
commit 0f60a3fc9919e8cde24ce6f769e1f0abf49c409a
Author: Francisco Javier Tirado Sarti
<[email protected]>
AuthorDate: Tue Mar 18 13:28:04 2025 +0100
Updating broken python example (#2086)
The example does not longer depend on numpy library
---
.../serverless-workflow-python-quarkus/README.md | 6 ++----
.../serverless-workflow-python-quarkus/pom.xml | 15 ---------------
.../serverless-workflow-python-quarkus/requirements.txt | 1 -
.../src/main/resources/python.sw.json | 6 +++---
.../test/java/org/kie/kogito/examples/PythonRestIT.java | 2 +-
5 files changed, 6 insertions(+), 24 deletions(-)
diff --git
a/serverless-workflow-examples/serverless-workflow-python-quarkus/README.md
b/serverless-workflow-examples/serverless-workflow-python-quarkus/README.md
index 9721186d9..5337e08f4 100644
--- a/serverless-workflow-examples/serverless-workflow-python-quarkus/README.md
+++ b/serverless-workflow-examples/serverless-workflow-python-quarkus/README.md
@@ -2,7 +2,7 @@
## Description
-This example contains a simple workflow definition that executes numpy
generator
+This example contains a simple workflow definition that executes a python
standard function library
## Installing and Running
@@ -13,9 +13,7 @@ You will need:
- Environment variable JAVA_HOME set accordingly
- Maven 3.8.6+ installed
- Python3 installed
- - Python required libraries, equivalent to run `pip install -r
requirements.txt`, will be automatically installed when running Maven.
-> **_NOTE:_** Requirements.txt install Jep as the last one because it depends
on the NumPy library to work correctly.
When using native image compilation, you will also need:
- [GraalVm](https://www.graalvm.org/downloads/) 19.3.1+ installed
@@ -66,4 +64,4 @@ The service based on the JSON workflow definition can be
access by sending an em
`curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json'
-d '{}' http://localhost:8080/python_helloworld`
-It will return as result a random array of three numbers.
+It will return as result the current year
diff --git
a/serverless-workflow-examples/serverless-workflow-python-quarkus/pom.xml
b/serverless-workflow-examples/serverless-workflow-python-quarkus/pom.xml
index 2b3afde18..330d1864c 100644
--- a/serverless-workflow-examples/serverless-workflow-python-quarkus/pom.xml
+++ b/serverless-workflow-examples/serverless-workflow-python-quarkus/pom.xml
@@ -156,21 +156,6 @@
<artifactId>exec-maven-plugin</artifactId>
<version>${version.exec.plugin}</version>
<executions>
- <execution>
- <id>dependencies-install</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>exec</goal>
- </goals>
- <configuration>
- <executable>pip</executable>
- <arguments>
- <argument>install</argument>
- <argument>-r</argument>
- <argument>${project.basedir}/requirements.txt</argument>
- </arguments>
- </configuration>
- </execution>
<execution>
<id>jep</id>
<phase>generate-resources</phase>
diff --git
a/serverless-workflow-examples/serverless-workflow-python-quarkus/requirements.txt
b/serverless-workflow-examples/serverless-workflow-python-quarkus/requirements.txt
deleted file mode 100644
index 144b0933a..000000000
---
a/serverless-workflow-examples/serverless-workflow-python-quarkus/requirements.txt
+++ /dev/null
@@ -1 +0,0 @@
-numpy>=1.21.0
diff --git
a/serverless-workflow-examples/serverless-workflow-python-quarkus/src/main/resources/python.sw.json
b/serverless-workflow-examples/serverless-workflow-python-quarkus/src/main/resources/python.sw.json
index 4b1994747..1aabfa1b3 100644
---
a/serverless-workflow-examples/serverless-workflow-python-quarkus/src/main/resources/python.sw.json
+++
b/serverless-workflow-examples/serverless-workflow-python-quarkus/src/main/resources/python.sw.json
@@ -21,7 +21,7 @@
"name" : "Imports",
"refName": "python",
"arguments": {
- "script": "import numpy as np"
+ "script": "import time as tm"
}
}
},
@@ -29,13 +29,13 @@
"functionRef": {
"refName": "python",
"arguments": {
- "script": "rng =
np.random.default_rng().integers(low=0,high=10,size=3)"
+ "script": "rng = tm.gmtime().tm_year"
}
}
}
],
"stateDataFilter" : {
- "output" : "{result:$WORKFLOW.python.rng}"
+ "output" : "{year:$WORKFLOW.python.rng}"
},
"end": true
}
diff --git
a/serverless-workflow-examples/serverless-workflow-python-quarkus/src/test/java/org/kie/kogito/examples/PythonRestIT.java
b/serverless-workflow-examples/serverless-workflow-python-quarkus/src/test/java/org/kie/kogito/examples/PythonRestIT.java
index d90ee6429..48b2112f8 100644
---
a/serverless-workflow-examples/serverless-workflow-python-quarkus/src/test/java/org/kie/kogito/examples/PythonRestIT.java
+++
b/serverless-workflow-examples/serverless-workflow-python-quarkus/src/test/java/org/kie/kogito/examples/PythonRestIT.java
@@ -39,6 +39,6 @@ public class PythonRestIT {
.then()
.statusCode(201)
.extract().as(JsonNode.class);
- assertThat(node.get("workflowdata").get("result")).hasSize(3);
+
assertThat(node.get("workflowdata").get("year").intValue()).isGreaterThanOrEqualTo(2025);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]