Teradata Package for Python Function Reference | 17.10 - setup_sandbox_env - Teradata Package for Python
Teradata® Package for Python Function Reference
- Teradata Package for Python
- Release Number
- April 2022
- English (United States)
- Last Update
- Product Category
- Teradata Vantage
- teradataml.table_operators.sandbox_container_util.setup_sandbox_env = setup_sandbox_env(sandbox_image_location=None, sandbox_image_name=None, container_id=None, timeout=5000)
Function to either load sandbox image and start a new docker container by passing
the "sandbox_image_location" and "sandbox_image_name" or
start an existing container using the argument "container_id".
1. Teradata recommends to run this function once before running
test_script() method of Script.
2. Sandbox image loading on user's system is skipped if the image is already
3. There can be only one container started from within teradataml at any given
4. At the end of the session image loaded / container started by the function
will be cleaned up.
5. If the user wishes to manually cleanup image / container started by the
function, they can use cleanup_sandbox_env().
6. User should be careful while providing "sandbox_image_location" and
"sandbox_image_name". If an incorrect "sandbox_image_name" is provided that
does not match with the name / tag of the image to be loaded then:
a. The image will not be loaded. User should re-run the function with
b. If the user's system already has an image with the image name / tag
same as the image specified in "sandbox_image_location" then the new image
will be loaded and it might replace the old image.
Specifies the path to the sandbox image on user's system.
1. For location to download sandbox image refer teradataml User Guide.
2. After loading the image, a container will be created and started.
3. "sandbox_image_location" and "sandbox_image_name" must be
Specifies the name of the sandbox image that was used for generating the image.
This will be used for starting a container.
1. "sandbox_image_location" and "sandbox_image_name" must be
2. If the "sandbox_image_name" is incorrect then the image will not be
Optional Argument. Required if "sandbox_image_location" and
"sandbox_image_name" are not specified.
Specifies id of an existing docker container.
User should be careful while specifying this argument.
If this argument is specified to start the container then this container
will be cleaned up at the end of the session.
Specifies timeout value for docker API calls. This is particularly useful
while loading large sandbox images. User should increase the "timeout" value
if image loading fails because of timeout.
Default Value: 5000
Warning, docker.errors.APIError, docker.errors.NotFound, TeradataMlException,
>>> from teradataml.table_operators.sandbox_container_util import setup_sandbox_env
# Example 1: Load the image from the location specified in "sandbox_image_location"
# argument and start a container.
# This is useful when the user wants to setup sandbox environment with a new image.
Loading image from /tmp/stosandbox.tar.gz. It may take few minutes.
Image loaded successfully.
# Example 2: Start an existing container specified in "container_id" argument.
# This is useful when the user wants to run user script in an existing container.
Container 3fadb1e8bac3 started successfully.