Machine learning service setup
Machine learning service is used for predicting values based on large volumes of historical data and current facts. Read more >>>
This article provides instructions on machine learning service setup for on-site users of bpm’online 7.12.2 and up.
Attention
Base knowledge of Docker, Linux or Windows administration is required to set up the machine learning service.
Contents
•Preparing for the machine learning service setup
•Machine learning service setup
•Updating the machine learning service components
Preparing for the machine learning service setup
To set up the service, you need to have a server (physical or virtual machine) with Linux or Windows OS installed. Docker software is used for installing the service components. Use this link to download the archive with configuration files and scripts needed to set up machine learning on-site.
Attention
We recommend using Linux-based server for production environment. You can only use a Windows based server for the development environment. Contact the support service to receive Docker containers that care compatible with Windows.
Note
Depending on your company needs you can use either Docker Community Edition (CE) or Enterprise Edition (EE). Learn more in the Docker Guide.
Recommended system requirements to the server
Processor | 64-Bit processor, minimum 4 cores |
RAM | 8 GB or more |
HDD | 20 GB or more of hard drive free space |
OS | Linux application setup files that support Docker. Supported Linux families are covered in the Docker guide. We recommend using stable Ubuntu or Debian versions. 64-Bit versions of Windows 10, Windows Server 2016 that support the Hyper-V technology. |
Docker | v.18.03.1 and higher |
Machine learning service components
The machine learning service uses the following components (Fig. 1):
•ML Service – machine learning web service. The only component enabling external access.
•R Engine – machine learning engine based on the OpenCPU system. Read more >>>
•Redis – session and cache storage server. Read more >>>
•ML Task Scheduler – task scheduler.
•MySQL– MySQL database. You can access it via the standard 3306 port.
All the components are packed as Docker images for the convenient on-site installing of the service.
Machine learning service setup
Algorithm of machine learning service setup:
1.Install Docker. Read more >>>
2.Install Docker Compose. Read more >>>
3.Install and set up the service components. Read more >>>
4.Verify the installation. Read more >>>
Installing Docker for Linux OS is covered in the Docker guide.
Run the “docker --version” command on Linux machine to verify the installed Docker version.
Installing Docker Compose for Linux OS is covered in the Docker guide.
Run the “docker-compose --version” command on Linux machine to verify the installed Docker Compose version.
Setting up the machine learning service components
All the machine learning service component containers are deployed via the Docker Compose utility. Use the following link to access the configuration files and scripts necessary for deploying and setup of the service components.
Note
The configuration files contain all necessary default settings for a Linux based server.
The archive structure of the configuration files and scripts:
\etc\
..\Db\sql\ – the folder containing scripts for deploying and update of the service database (DB).
..\Db\migrate-after-mysql-connected.sh – the script for running the DB.
..\Ml-service\appsettings.json – the ML web service configuration.
..\Ml-service\log4net.config – setup of the web service logging level.
..\Opencpu\config.yml – the “R Engine” configuration.
..\Redis\redis.conf – Redis server setup file.
..\Task-scheduler\appsettings.json – the “ML Task Scheduler” utility configuration.
..\Task-scheduler\log4net.config – setup of “ML Task Scheduler” logging level.
Docker-compose.yml – the “Docker Compose” utility configuration.
.env – the file containing environment variables for running the components. For example, it contains MySql password.
Attention
If you need to change the password to MySql database, you need to update it in the .env file as well as in other configuration files that contain database access setup sections.
Setting up the machine learning service components
1.Download and unzip the archive with the configuration files and scripts to a local catalog, for example, /opt/ml.
2.Using the Linux terminal, go to the /docker-compose catalog of the unzipped archive, for example, /opt/ml/docker-compose.
3.Run the “sudo docker-compose pull” command in the terminal. Wait until the download of the necessary service component images from the Docker Hub is complete.
Attention
If the server has no access to the Internet, manually download all necessary images on a computer with open access (see the “docker-compose.yml” configuration file). Then use the sudo docker export and sudo docker import commands to transfer the images to the target computer as files.
4.Run the sudo docker-compose run dbmigration command to initialize the database structure. Wait until the command execution is complete.
5.Run the sudo docker-compose up -d command to launch the services. A “logs” folder will be created in the current catalog.
Verification of setting up the machine learning service components
1.To verify the installation of ML web service, run the following command in Linux:
curl -d '' -H 'Content-Type:application/json' -X POST localhost:5005/ping
The service must return the following response:
{“output”:”Ok”}
2.To verify the launch of ML Task Scheduler, make sure the “../docker-compose/logs/task-scheduler/MLTaskScheduler.log” file contains the records.
3.To verify creating of tables, run the following command in the terminal:
docker exec -it [DB Container Id] mysql -u root --password=Supervisor ml -e "show tables;"
where [DB Container Id] is an identifier of the container with a database component. You can find out the container identifier using the sudo docker ps command.
Example
Verification of creating tables:
docker exec -it [DB Container Id] mysql -u root --password=Supervisor ml -e "show tables;"
As a result, the names of primary service tables should be displayed: “modelinstance”, “traindata”, “trainsession”, etc.
Updating the machine learning service components
Attention
We recommend saving a backup copy of MySQL database, before you update the services. Read more >>>
1.Using the Linux terminal, go to the docker-compose catalog with the configured files, for example, /opt/ml/docker-compose.
2.Run the sudo docker-compose stop command to stop the service component containers.
3.Run the sudo docker-compose pull command in the terminal. Wait until the download of the necessary service component images from Docker Hub is complete.
4.Run the sudo docker-compose run dbmigration command to initiate the database structure. Wait until the command execution is complete.
5.Run the sudo docker-compose up -d command to launch the services.
See also
•Machine learning service (development guide)