To use the Python transformation with additional libraries, the runtime environment must have access to an installation of Python and the resource files that you reference in the Python code. When you install Python, you can include any third-party libraries such as numpy, scikit-learn, and cv2. You can access the third-party libraries in the Python code.
If you have a custom Python installation, you cannot perform a test run of the mapping. You must create a mapping task based on the elastic mapping and provide
for the advanced session property.
Install Python and add resource files based on the type of runtime environment:
Add the Python installation in the following directory on the Secure Agent machine:
<Secure Agent installation directory>/ext/python/
If you reference resource files in the Python code, add the resource files to the same directory. To maintain consistency, you can store the resource files in a dedicated folder named python_resources.
Consider the following guidelines:
If the Secure Agent machine stops unexpectedly and the agent restarts on a different machine, you must add the Python installation and resource files to the same directory on the new machine.
If you update the Python installation or resource files on the Secure Agent machine, the files take effect the next time that you run a job on the elastic cluster.
To prevent long-running jobs from failing, do not update the files on the Secure Agent machine more than four times while you have jobs running.
Serverless runtime environment
Install Python and add resource files in the supplementary file location.
If you update the Python installation or resource files, you must redeploy the serverless runtime environment for the changes to take effect.
For more information about the supplementary file location, see