tree: 809df6b8c41f090d82fbfe48f8b5300b66383c1b [path history] [tgz]
  1. data/
  2. model/
  3. src/
  4. utils/
  5. get-pip.py
  6. pom.xml
  7. README.md
  8. requirements.txt
serverless-workflow-examples/serverless-workflow-openvino-quarkus/README.md

Kogito Serverless Workflow - Openvino Hello World Example

Description

This example contains a workflow definition that emulates functionality exposed by openvino hello world example

The flow, given an image file name containing a dog image, returns that dog's race.

Installing and Running

Prerequisites

You will need:

  • Java 17+ installed
  • Environment variable JAVA_HOME set accordingly
  • Maven 3.9.6+ installed
  • Python 3+ installed. In Linux system is usually pre-installed. In case you have an older version or you are not using Linux, check here
  • Pip installed. In case it not there, run python -m ensurepip --upgrade
  • Python required libraries, equivalent to run pip install -r requirements.txt and pip install jep, 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 22.3.2+ installed
  • Environment variable GRAALVM_HOME set accordingly
  • LD_LIBRARY_PATH should include GRAALVM_HOME/lib/server

Note that GraalVM native image compilation typically requires other packages (glibc-devel, zlib-devel and gcc) to be installed too. You also need ‘native-image’ installed in GraalVM (using gu install native-image). Please refer to GraalVM installation documentation for more details.

Compile and Run in Local Dev Mode

mvn clean package quarkus:dev

Compile and Run in JVM mode

mvn clean package 
java -jar target/quarkus-app/quarkus-run.jar

Compile and Run using Local Native Image

Note that this requires GRAALVM_HOME to point to a valid GraalVM installation Also LD_LIBRARY_PATH should include GRAALVM_HOME/lib/server

mvn clean package -Pnative

It will take a while, once finished, run the generated executable.

./target/serverless-workflow-openvino-quarkus-{version}-runner

Submit a request

Once the server is running, you can test it by sending a request to http://localhost:8080/openvino_helloworld with following content

{
  "fileName": "path to a file containing a picture of a dog"
}

Complete curl command can be found below:

curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"fileName": <path>}' http://localhost:8080/openvino_helloworld

The flow should return a message with the dog race as property group.