Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.07 KB

File metadata and controls

44 lines (32 loc) · 1.07 KB
resources category weight
examples/tutorials/flow-deploy/create-service-with-flow
deployment
10

Create service with flow

This example shows how to create a simple service with flow.

You can create your own service by utilize flow-as-function.

This folder contains a example on how to build a service with a flow. Reference here for a minimal service example. The output of score.py will be a json serialized dictionary. You can use json parser to parse the output.

1. Start the service and put in background

nohup python simple_score.py &
# Note: added this to run in our CI pipeline, not needed for user.
sleep 10

2. Test the service with request

Executing the following command to send a request to execute a flow.

curl -X POST http://127.0.0.1:5000/score --header "Content-Type: application/json" --data '{"flow_input": "some_flow_input", "node_input": "some_node_input"}'

Sample output of the request:

{
  "output": {
    "value": "some_flow_input"
  }
}

Reference here for more.