Spring-Boot2 wrapper around legacy Python code to generate Embeddings. The wrapper makes the performance of a single request a bit slower, but makes the API more stable and capable of processing multiple requests at the same time (at the cost of increasing memory usage)
- Java 17
- Maven*
- Europeana parent pom
- Python3.6
* A Maven installation is recommended, but you could use the accompanying mvnw
(Linux, Mac OS) or mvnw.cmd
(Windows)
files instead.
mvn clean install
(add -DskipTests
) to skip the unit tests during build
The application has a Tomcat web server that is embedded in Spring-Boot.
Either select the EmbeddingsApplication
class in your IDE and 'run' it
or
go to the application root where the pom.xml is located and excute
./mvnw spring-boot:run
(Linux, Mac OS) or mvnw.cmd spring-boot:run
(Windows)
Launch a Python process manually. For this either use the Dockerfile in the python
folder or make sure Python 3.6 is installed.
When using Docker to launch Python:
- Don't forget to map the port specified in the test-run.sh file.
- In the
Executor
class modify the 127.0.0.1 address to the IP of the Docker container and comment out thecreateProcess
method. - In the
EmbeddingsService
class, comment out the Python 3.6 check in thecheckRequirements
method.
-
Generate a Docker image using the project's Dockerfile
-
Configure the application by generating a
embedding.user.properties
file and placing this in the k8s folder. After deployment this file will override the settings specified in theembedding.properties
file located in the src/main/resources folder. The .gitignore file makes sure the .user.properties file is never committed. -
Configure the deployment by setting the proper environment variables specified in the configuration template files in the k8s folder
-
Deploy to Kubernetes infrastructure.
For good performance we recommend deploying the Embedding API on a server that has a recent NVIDIA card. This will speed up embedding generation significantly.
- NVIDIA graphics drivers are installed
- NVIDIA Container Toolkit is installed (and the system is restarted after installation)
- Run
nvidia-smi
to check if the GPU can be accessed - Docker is installed
Copy the the project's docker-compose.yml file to the server and run docker-compose up
.
Licensed under the EUPL 1.2. For full details, see LICENSE.md.