How to deploy, configure, and use the Prisme.ai Functions Microservice for running custom NodeJS and Python code in your applications
NPM_CONFIG_REGISTRY
environment variable to specify your own registry.Python Configuration
Variable Name | Description | Default Value |
---|---|---|
PYTHON_FUNCTIONS_RUN_TIMEOUT | Python functions execution timeout in milliseconds | 20000 |
PYTHON_API_URL | Python API URL | http://localhost:8000 |
KERNEL_POOL_SIZE | Number of python processes (each thread can execute only 1 function at a time) | Defaults to current cpu cores number |
NodeJS Configuration
Variable Name | Description | Default Value |
---|---|---|
PORT | HTTP port for the service | 4000 |
FUNCTIONS_STORAGE_FILESYSTEM_DIRPATH | Directory path for function storage | data/functions/ |
FUNCTIONS_RUN_TIMEOUT | Functions execution timeout in milliseconds | 20000 |
FUNCTIONS_WORKERS_MAX_LRU | Maximum number of function workers kept in memory | 500 |
NODE_BUILTIN_MODULES | Allowed Node.js built-in modules | http, https, url, util, zlib, dns, stream, buffer, crypto |
NPM_CONFIG_REGISTRY | NPM registry URL | https://registry.npmjs.org/ |
NODE_WORKER_MAX_OLD_GENERATION_SIZE_MB | NodeJS function worker maxOldGenerationSizeMb | 100 |
INACTIVE_NODE_WORKER_DELETION_TIMEOUT | Inactive period in seconds after which node workers are automatically terminated | 3600 |
UPDATE_SCRIPTS_ON_STARTUP | If set to “yes” or “true”, ensures function scripts are in-sync with corresponding workspace.yaml files on startup | no |
REQUEST_MAX_SIZE | Maximum request body size (format from bodyParser.json) | 1mb |
Create a Test Function
test
containing a hello
function:Execute the Function
Verify Resource Limits
Asynchronous Functions
async
keywordawait
keywordShared Execution Context
Shared Memory Cache
Dependency Management
Function Creation Fails
Function Execution Timeouts
FUNCTIONS_RUN_TIMEOUT
or PYTHON_FUNCTIONS_RUN_TIMEOUT
settingMemory-Related Errors