Pricing Try it now
SENTIENT ANALYTICS
Getting Started Documentation Guides
How To Activate SENTIENT ANALYTICS
On this page

SENTIENT ANALYTICS Python Executor Configuration

Overview

SENTIENT ANALYTICS Python Executor is required to run:

  • Python Calculation fields
  • All prediction models (except Fourier Transformation)
  • Code generation for Metric Explorer

Starting from version 1.14.0, the only way to run these features is via SENTIENT ANALYTICS Python Executor using Docker (or Kubernetes).

Prerequisites

Windows

  • Have Docker Desktop for Windows. You can find out how to install it here

Linux

  • Have Docker CE. You can find out how to install it here
  • Have Docker Compose. You can find out how to install it here

Python Executor Standalone Installation

Step 1: Create Docker Compose File

Create the Docker Compose file with the following configuration:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
services:
  sentient-analytics-python-executor:
    restart: always
    image: "sentient/sentient-analytics-python-executor:1.15.0.4"
    ports:
      - "8181:8181"
    environment:
      EXECUTOR_MANAGER: 1
      EXECUTOR_SCRIPT_ENGINE: 6
      THROTTLING_QUEUE_CAPACITY: 10
      THROTTLING_THREAD_POOL_SIZE: 6
      NETWORK_BUFFER_SIZE: 5242880
    volumes:
      - sentient-analytics-python-executor-conf:/python-executor-config-files
      - sentient-analytics-python-executor-data:/data

Explanation of key fields:

  • 8181 - Python executor port for communication with SENTIENT ANALYTICS service
  • restart: always - automatically restarts the executor on failure or system reboot
  • sentient/sentient-analytics-python-executor:1.15.0.4 - Docker image for SENTIENT ANALYTICS Python Executor
  • sentient-analytics-python-executor-conf:/python-executor-config-files - mounts the volume ``sentient-analytics-python-executor-conf` to SENTIENT ANALYTICS Python Executor directory with configuration files
  • sentient-analytics-python-executor-data:/data - mounts the volume sentient-analytics-python-executor-data to SENTIENT ANALYTICS Python Executor additional data directory

Step 2: Start Python Executor

1
2
docker compose up -d
docker compose logs -f sentient-analytics-python-executor

Step 3: Connect SENTIENT ANALYTICS to Python Executor

  • Linux or Mac OS

Configure SENTIENT ANALYTICS to communicate with the Python Executor.

Edit /usr/share/sentient-analytics/conf/sentient-analytics.conf and add:

1
2
3
export SCRIPT_ENGINE_TIMEOUT=30000
export SCRIPT_ENGINE_PROVIDER=DOCKER_CONTAINER
export SCRIPT_ENGINE_DOCKER_PROVIDER_URL=PYTHON_EXECUTOR_HOST:PYTHON_EXECUTOR_PORT

Replace PYTHON_EXECUTOR_HOST and PYTHON_EXECUTOR_PORT with your Python Executor service values and ensure SENTIENT ANALYTICS can reach this network destination.

  • Windows

Open Notepad as Administrator and edit:

1
C:\Program Files (x86)\sentient-analytics\conf\sentient-analytics.yml

Locate the script-engine block and configure:

1
2
3
4
5
6
7
script-engine:
  provider: "${SCRIPT_ENGINE_PROVIDER:DOCKER_CONTAINER}"
  runtime-timeout: "${SCRIPT_ENGINE_TIMEOUT:60000}"
  callback-timeout: "${SCRIPT_ENGINE_TIMEOUT:60000}"
  docker-provider-url: "${SCRIPT_ENGINE_DOCKER_PROVIDER_URL:PYTHON_EXECUTOR_HOST:PYTHON_EXECUTOR_PORT}"
  websocket-buffer-size: "${SCRIPT_ENGINE_WEBSOCKET_BUFFER_SIZE:20971520}"
  websocket-concurrency: "${SCRIPT_ENGINE_WEBSOCKET_CONCURRENCY:5}"

Replace PYTHON_EXECUTOR_HOST and PYTHON_EXECUTOR_PORT with your Python Executor service values and ensure SENTIENT ANALYTICS can reach this network destination.

How to Migrate SENTIENT ANALYTICS Python Executor 1.13.2 to SENTIENT ANALYTICS Python Executor 1.14.0

If you already have a Python Executor with a version earlier than 1.14.0 connected to SENTIENT ANALYTICS, you should migrate it before updating SENTIENT ANALYTICS to 1.14.0.

Step 1. Modify Docker Compose File

Locate the docker-compose.yml file from which the Python Executor was launched.

Change the Python Executor image tag to version 1.14.0 and update the volumes section to include configuration and data directories.

The final docker-compose.yml should look like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
services:
  sentient-analytics-python-executor:
    restart: always
    image: "sentient/sentient-analytics-python-executor:1.15.0.4"
    ports:
      - "8181:8181"
    environment:
      EXECUTOR_MANAGER: 1
      EXECUTOR_SCRIPT_ENGINE: 6
      THROTTLING_QUEUE_CAPACITY: 10
      THROTTLING_THREAD_POOL_SIZE: 6
      NETWORK_BUFFER_SIZE: 5242880
    volumes:
      - sentient-analytics-python-executor-conf:/python-executor-config-files
      - sentient-analytics-python-executor-data:/data

Step 2. Restart Python Executor

Restart the Python Executor to apply the changes:

1
2
docker compose up -d
docker compose logs -f sentient-analytics-python-executor

How to Connect Additional Libraries to the Python Executor

If necessary, you can add additional Python libraries to the Python Executor and use them in your SENTIENT ANALYTICS Calculation Fields or SENTIENT ANALYTICS Custom Prediction Models.

For example, if you want to add the emoji library (specific version 2.2.0), follow these steps.

Step 1. Open a shell in the running container

1
docker compose exec sentient-analytics-python-executor bash

Step 2. Add library to requirements.txt

You need to append the library name and version to the requirements.txt file located in your configuration directory (/python-executor-config-files):

1
echo 'emoji==2.2.0' >> /python-executor-config-files/requirements.txt

After append all necessary dependencies type exit to exit from a shell.

Step 3. Restart the Docker Container

Find the container name and restart it:

1
docker compose restart sentient-analytics-python-executor

Step 4. Verify Installation

Check the logs to ensure the library was installed successfully:

1
docker compose logs sentient-analytics-python-executor

You should see:

1
2
Installing custom Python requirements...
Requirement already satisfied: emoji==2.2.0 in /usr/local/lib/python3.9/site-packages

After the container restarts, you can import and use the custom libraries in your SENTIENT ANALYTICS Calculation Fields or SENTIENT ANALYTICS Custom Prediction Models.

Next steps

  • Getting started guide - These guide provide quick overview of main SENTIENT ANALYTICS features.

  • Metric Explorer - Learn how to explore and create new metrics with SENTIENT ANALYTICS Metric Explorer.

  • Anomaly Detection - Learn how to identify anomalies in the data.

  • Calculated Fields - Learn about Calculated fields and how to use them.

  • States - Learn how to define and analyse states for assets based on raw telemetry.

  • Prediction - Learn how to make forecasts and predict telemetry behavior.

  • Filters - Learn how filter dataset during analysis.

  • Available Visualizations - Learn about visualization widgets available in SENTIENT ANALYTICS and how to configure them.

  • Share and embed Visualizations - Learn how to add SENTIENT ANALYTICS visualizations on SENTIENT dashboard or 3rd party web pages.

  • AI Assistant - Learn how to utilize SENTIENT ANALYTICS AI capabilities.