Remote Python Executor (RPE) Installation

Install Remote Python Executor (RPE)

Overview

The Remote Python Script Snap can execute a Python script natively on local or remote Python executors. The Remote Python Executor (RPE) can be installed either on the same node as the Snaplex or on a remote node that is accessible from the Snaplex.

Key steps involved in installing the RPE:
  1. Establish an SSH connection to the node.
  2. Install Docker CE.
  3. Create and start the RPE container.
  1. SSH to the node: Establish an SSH connection to the node where you want to install the RPE. The latter steps may require root access.
  2. Install Docker: Follow the instructions on the official Docker site to install Docker CE on your machine.
    To install Docker on a specific operating system, use the appropriate link from the following:
  3. Start RPE container:
    1. CPU Instance: Execute the following command to pull the image from Docker Hub and start RPE container:
      docker pull snaplogic/rpe:main-5
      docker run --memory-swap="-1" --restart=always -dti -p 5301:5301 -e "REMOTE_PYTHON_EXECUTOR_TOKEN=" -v /opt/remote_python_executor_log/:/opt/remote_python_executor_log/ --name=rpe snaplogic/rpe:main-5  								
      Table 1. Command Options
      Option Format Description
      --memory-swap="-1" --memory-swap="<memory_swap_limit>" The container can use unlimited space for memory swapping. See Memory Swap for more information.
      –restart=always –restart=always Automatically restarts the docker container if the machine restarts.
      -p 5301:5301 -p <host_port>:5301 The RPE is accessible from the host port which is 5301 by default. You may change the host port to support multiple containers on the same node.
      -e "REMOTE_PYTHON_EXECUTOR_TOKEN=" -e "REMOTE_PYTHON_EXECUTOR_TOKEN=<token>" The default token is empty. A strong token is recommended.
      -v /opt/remote_python_executor_log/: /opt/remote_python_executor_log/ -v <log_dir>/opt/remote_python_executor_log/ The log is mounted to /opt/remote_python_executor_log/ by default. This location can be changed.
      --name=rpe --name=<container_name> The container’s name can be changed in case of multiple containers on the same node.
    2. Manage RPE: Since the RPE starts with the container, use the following commands to start, stop, restart, and remove the RPE.
      docker start rpe
      docker stop rpe
      docker restart rpe
      docker rm rpe
  4. Custom Image: Download the custom RPE package. This package contains Dockerfile and others. You can modify the Docker file and add required libraries in requirements.txt. Then, run the following command to build the Docker image.
    Important: Make sure to run cd into the directory containing the Dockerfile.
    docker build --no-cache -t snaplogic_custom_rpe .
    1. Once the image is built, execute the following command to create and start the custom RPE container.
      docker run --memory-swap="-1" --restart=always -dti -p 5301:5301 -e "REMOTE_PYTHON_EXECUTOR_TOKEN=" -v /opt/remote_python_executor_log/:/opt/remote_python_executor_log/ --name=rpe snaplogic_custom_rpe
      Note:

      You can view the list of the RPE image versions here. We recommend that you always use the latest version (main-X).