Extra Horizon
GitHub
  • Extra Horizon Documentation
  • Getting Started
    • Start familiarizing yourself
  • Tutorials
    • Medical Device Tutorial
      • Preparation
      • Build your first prototype
        • Define a data model
        • Configure your workflows
          • Workflow 1: Analyze a measurement
          • Workflow 2: Create & store a PDF report
          • Workflow 3: Send an e-mail
        • Define your permissions
          • Update your schema with user permissions
          • Update your schema with group permissions
        • Build the Front-End
          • Set up oAuth in your backend
          • Demo login page
      • Summary & Wrap up
    • Polysomnography (PSG) Tutorial
    • Retool - Building dashboards Tutorial
  • FAQ
    • General
  • Services
    • Identity and Access Management
      • User service
        • Users
        • Groups
        • Global roles
        • Configuration
      • Auth Service
        • Applications
        • OAuth2
        • OAuth1
        • MFA
        • OpenID Connect
          • Google Cloud
          • Azure ADFS
    • Data Management
      • File Service
      • Data Service
        • Schemas
        • Documents
        • FAQ Data Service
    • Automation
      • Task Service
        • Functions
        • Tasks
        • API Functions
        • Examples
          • Hello world (JS)
          • Hello world (Py)
          • Hello world (Docker)
        • FAQ
      • Dispatchers Service
      • Event Service
        • System Events
    • Communication
      • Notification Service
        • Notifications
        • Settings
      • Mail Service
    • Other
      • Localization Service
        • Language Codes
      • Template Service
        • Localizations
      • Payments Service
        • Subscriptions
        • Stripe
        • iOS App Store
      • Configurations Service
  • API Reference
    • OpenAPI Specifications
    • 📦Changelog
      • Per-service Changelog
    • Postman Reference Collection
  • Tools
    • SDK
    • CLI
    • Control Center
  • Additional Resources
    • Resource Query Language (RQL)
    • Handling Errors
    • GitHub
    • API interaction (Python)
    • Migration guide: Enabling verification request limiting
  • ExH Platform
    • 🙋Support
    • ⏱️Usage and Performance
    • 🔓Security
    • 🗺️Regions
    • ⚖️Cloud Subscription Agreement
    • 🇺🇸CFR 21 Part 11
Powered by GitBook
On this page
  • Deploying a Function
  • Tutorial
  • List functions
  • Delete a function
  • Function Properties
  • name
  • description
  • entryPoint
  • runtime
  • timeLimit
  • memoryLimit
  • environmentVariables
  • retryPolicy
  • executionOptions

Was this helpful?

  1. Services
  2. Automation
  3. Task Service

Functions

PreviousTask ServiceNextTasks

Last updated 10 months ago

Was this helpful?

A Task represents a planned or scheduled piece of code. The code definition is a Function in Extra Horizon.

Deploying a Function

Developers can leverage the power of the Extra Horizon CLI to efficiently create new Functions and seamlessly update existing ones, this can be achieved by using the exh tasks sync command.

exh tasks sync --name=my-function \
  --code=/my/path/to/my-function \
  --entryPoint=index.handler \
  --runtime="nodejs14.x"

See the for more information.

Tutorial

A step-by-step guide on how to deploy a Function is available in the example.

The may be used within a Function to easily interface with Extra Horizon services.

List functions

exh tasks list <options>

See the for more information.

Delete a function

In order to Delete a Task Function, you will need as a User to have the DELETE_TASK_FUNCTION permission.

exh tasks delete <options>

If a function is removed from the task service its executions (tasks) and the logs aren't removed and can still be retrieved

Function Properties

{
  "name": "my-function",
  "description": "This is an example of a test Lambda function",
  "entryPoint": "index.handler",
  "runtime": "nodejs14.x",
  "timeLimit": 60,
  "memoryLimit": 256,
  "environmentVariables": {
    "CLIENT_ID": {
      "value": "my-token-value" 
    },
    "CLIENT_SECRET": {
      "value": "my-secret-value" 
    }
  },
  "retryPolicy": {
    "enabled": true,
    "errorsToRetry": [
      "CONNECTION_ERROR",
      "DATABASE_ERROR"
    ]
  },
  "executionOptions": {
    "permissionMode": "permissionRequired"
  },
}

name

The name property serves as the unique identifier amongst all Functions.

description

The description property may be supplied to provide a brief explanation regarding a Function's purpose.

entryPoint

The entryPoint property refers to the method in the Function code that is executed.

runtime

The runtime property selects the runtime (or environment) the Function will be running in. The Task Service utilizes AWS Lambda to run Functions. Any runtime supported by AWS Lambda is supported by the Task Service.

timeLimit

The timeLimit represents the maximum allowed execution time limit for this Function in seconds. This value may have a minimum value of 3 seconds and a maximum value of 300 seconds.

memoryLimit

The memoryLimit allocates the desired memory for a Function's execution in MB. This value may have a minimum value of 128 MB and a maximum value of 10240 MB.

environmentVariables

The environmentVariables represent the environment variables in the Function execution runtime.

The following code snippet shows an example how to configure the environment variables:

{
  ...
  "environmentVariables": {
    "CLIENT_ID": {
      "value": "my-token-value" 
    },
    "CLIENT_SECRET": {
      "value": "my-secret-value" 
    }
  }
}

retryPolicy

Available since v1.3.0

The retryPolicy field can be used to determine system behavior after the execution of a Function (Task) fails.

The following code snippet shows an example how to configure the retry policy:

{
  ...
  "retryPolicy": {
    "enabled": true,
    "errorsToRetry": [
      "CONNECTION_ERROR",
      "DATABASE_ERROR"
    ]
  }
}

retryPolicy Properties

enabled

The retry policy is disabled by default, If this field is set to true, the retry policy becomes active. If active the policy will retry a maximum of 3 times, with an increasing timeout of 2, 5 and 10 seconds respectively.

errorsToRetry

It is possible to restrict the retry policy to a specific set of errors using this property.

executionOptions

The executionOptions field may be used to configure how the function can be executed.

The following code snippet shows an example how to configure the execution options:

{
  ...
  "executionOptions": {
    "permissionMode": "permissionRequired"
  },
}

executionOptions Properties

permissionMode

This property determines execution restrictions based on its assigned value. One of the following values may be assigned to the permissionMode property to enforce execution restrictions.

permissionMode
Description

permissionRequired

allUsers

A user must be logged in, but no permission is required.

public

Any party may execute this function without any restrictions.

See the for more information.

See the AWS Lambda documentation for a list of supported runtimes:

The permissionMode is only considered for direct execution of a Function or .

A user requires a permission as stated for the section. This is the default permission mode.

For information regarding the application of permissions to users please refer to .

https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
API Functions
global roles
API Function permissions
hello world
Extra Horizon CLI documentation
Extra Horizon CLI documentation
Extra Horizon CLI documentation
Visual representation of the fixed retry policy
JavaScript SDK