Hello world (Py)
src/Index.py
First let's create a simple hello-world script. We are creating a function called handler() that will act as the entryPoint of our code. Our goal is to print a simple "hello world" to the console.
def handler(event, context):
print('Hello World!');
If you are using visual studio code, this should look something like this:

task-config.json
Next we need to create a configuration file that the Extra Horizon CLI can use to configure and deploy your function to you cluster.
To create the our function we need to provide the following information:
Name of the function
A description
Reference to the directory containing the (built) code (
code
)the entrypoint or the function that should be invoked when the function is triggered
the runtime you want your code to use
For our function it looks something like this:
{
"name": "hello-world-python",
"description": "python hello world example",
"path": "src",
"entryPoint": "index.handler",
"runtime": "python3.9"
}
In visual studio code your project should something like this:

Deploying with the ExH CLI
You can deploy your function to the task service using the EXH CLI Tool. run the sync task command in your terminal:
exh tasks sync --path=./task-config.json

You can see a hello-world function has been created in the task service. Visit the Task service documentation for more information.
Running your task using postman
Using postman we can create a new task execution for our hello-world function. Create a http POST method and mention the function name.

Verify using the ExH Control Center
You can log into the Extra Horizon control center to verify the execution of your function.

Go to tasks>hello-world-python>executions.

Success!! 🎉You just created your first python function in Extra Horizon
Tips
Last updated