Set up machine learning service
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 on Linux platforms is covered in the Docker guide.
Run the “docker --version” command on Linux machine to verify the installed Docker version.
Installing Docker Compose on Linux platforms is covered in the Docker guide.
Run the “docker-compose --version” command on Linux machine to verify the installed Docker Compose version.
Set up the machine learning service components
All the machine learning service component containers are deployed via the Docker Compose utility. Download the configuration files and scripts that are necessary to deploy and configure the service components. Download archive
Note
The configuration files contain all necessary default settings for a Linux based server.
The archive structure of the configuration files and scripts:
/etc/
../ml-service/appsettings.json – the ML web service configuration.
../ml-service/log4net.config – setup of the web service logging level.
../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.
Set up the machine learning service components
1.Download and unzip the archive with the configuration files and scripts to a custom directory, 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 required service component images from the Docker Hub is complete.
Attention
If the server is disconnected from the Internet, download all required images to an Internet-connected computer manually (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.
Verify the setup of the machine learning service components
6.To verify the installation of ML web service, run the following command in Linux:
curl -X GET localhost:5005/readiness
The service must return the following response:
Healthy
7.To verify the running of ML Task Scheduler, execute the following command in the Linux terminal:
curl -X GET localhost:5004/readiness
The service must return the following response:
Healthy
8.To verify the running of R Engine, execute the following command in the Linux terminal:
curl -X GET localhost:8081/readiness
The service must return the following response:
R Service is ready
9.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.
Case
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.
See also