Documentation Index

Fetch the complete documentation index at: https://kb.vastdata.com/llms.txt

Use this file to discover all available pages before exploring further.

Getting Started

Prev Next

Prerequisite Steps

  1. Application user for a DataEngine instance deployed on a VAST Cluster tenant. Deploying DataEngine and provisioning users requires cluster admin for the VAST cluster or a tenant admin user for the specific tenant.

    Note

    • For DataEngine deployment and user provisioning by a cluster admin user, see VAST DataEngine in the VAST Cluster 5.5 Administrator's Guide.

    • For DataEngine deployment and user provisioning by a tenant admin user, see VAST DataEngine in the VAST Cluster 5.5 Tenant Administrator's Guide.

  2. S3 access key pair for the user. (Can be created for or by the user).

  3. Install DataEngine CLI.Installing the VAST DataEngine CLI

Install the DataEngine Python SDK

pip install vast-dataengine-sdk

Create a Scaffold for a New Function

Run the vastde functions init command to create a scaffold for your function.

For example:

 vastde functions init python-pip my_first_function -t ~/functions/

The output is a directory structure needed for implementing your function.

~/functions/my-first_function/
├── Aptfile          # OS dependencies
├── README.md        # Project documentation
├── customDeps       # custom python libraries
├── main.py          # Handler functions
└── requirements.txt # Python dependencies

0 directories, 5 files

Once you have prepared your function scaffold, you can edit the files to implement your function. The main function code goes into main.py.

How to Structure Your Function Code

main.py is your initial default function code with the following content:

def init(ctx):
    # One time initialization comes here
    ctx.logger.info("Initialized...")

def handler(ctx, event):
    # Events Processing comes here
    ctx.logger.info(f"Handler {event}")
    return "Hello World"

Note

The runtime supports asynchronous event handling, which is recommended for improved throughput and performance. You can define your event handler as async def:

def init(ctx):
    # One time initialization comes here
    ctx.logger.info("Initialized...")

async def handler(ctx, event):
    # Events Processing comes here
    ctx.logger.info(f"Handler {event}")
    return "Hello World"

As you further implement your function, you must retain the following structure:

  • Write an init() function, once.

  • Write a handler function to handle each event. The handler function is invoked whenever the function receives an event.