Skip to content

spotfire-pythonservice

About this image

This directory contains the official container recipe for Spotfire® Service for Python ⧉.

What is Spotfire® Service for Python?

Spotfire® Service for Python (the Python service) provides remote execution of Python data functions for users from web client and mobile devices.

Note: The Spotfire Service for Python is a Spotfire Server component, provided and licensed under Spotfire Statistics Services in Spotfire Product downloads ⧉.

References:

How to build this image

The easiest and recommended way to build all the Spotfire container images is using the provided containers/Makefile. See Spotfire Cloud Deployment Kit on GitHub ⧉.

You can also build this image individually. Follow the instructions below or adjust them according to your needs.

Prerequisites:

Steps:

  1. Copy the Spotfire.Dxp.PythonServiceLinux.sdn package into the build/ directory within this folder.
  2. From the <this-repo>/containers folder, run make spotfire-pythonservice to build this image, or make spotfire-pythonservice --dry-run to preview the required commands.

Adding custom Spotfire packages

Before building the image, put any custom SPK files in the build/ folder.

How to use this image

Prerequisites:

Start a Python service container

You can start an instance of the Spotfire Service for Python container with:

docker run -d --rm -e ACCEPT_EUA=Y -e SERVER_BACKEND_ADDRESS=spotfire-server spotfire/spotfire-pythonservice

Note: This Spotfire container image requires setting the environment variable ACCEPT_EUA. By passing the value Y to the environment variable ACCEPT_EUA, you agree that your use of the Spotfire software running in this container will be governed by the terms of the Cloud Software Group, Inc. End User Agreement ⧉.

The spotfire-pythonservice will start with the default configuration from /opt/spotfire/nodemanager/nm/services/PYTHON/conf/custom.properties in the container image.

Starting with a custom configuration

To add Custom configuration properties ⧉ to the Python service configuration, you can mount your custom configuration file at /opt/spotfire/nodemanager/nm/services/PYTHON/conf/additional-custom.properties. This is needed only if a setting cannot be directly set by using any of the existing environment variable settings listed in the Environment variables section. Any setting here overrides properties found in the /opt/spotfire/nodemanager/nm/services/PYTHON/conf/custom.properties file.

docker run -d --rm -e ACCEPT_EUA=Y \
  -e SERVER_BACKEND_ADDRESS=spotfire-server \
  -v "$(pwd)/additional-custom.properties:/opt/spotfire/nodemanager/nm/services/PYTHON/conf/additional-custom.properties" \
  spotfire/spotfire-pythonservice

Example of an additional-custom.properties file:

# The maximum number of Python engine sessions that are allowed to run concurrently in the Python service.
engine.session.max: 5

# The number of Python engines preallocated and available for new sessions in the Python service queue.
engine.queue.size: 10

For more information, see Configuring the service ⧉.

How to add additional Python packages

You can prepare a shared folder in the container host with all the additional required Python packages preinstalled. For that, follow the instructions in Installing Python Packages Manually ⧉.

You can then mount that shared folder in your containers and use it as your shared package library location.

Example:

# You can populate the packages folder with pip.
# - python -m pip install --target=$(pwd)/packages -r requirements.txt
# - python -m pip install --target=$(pwd)/packages pandas numpy ...
docker run -d --rm -e ACCEPT_EUA=Y \
  -e SERVER_BACKEND_ADDRESS=spotfire-server \
  -v "$(pwd)/packages:/opt/packages" \
  spotfire/spotfire-pythonservice

Note: The shared package library location ⧉ configuration property packagePath is set to /opt/packages in this container image.

Environment variables

Note: These environment variables can only be used if the default configuration is used.

Note: See also the Spotfire node manager environment variables.