td_setup_sandbox_env() | Sandbox Container Utility | Teradata Package for R - td_setup_sandbox_env() - Teradata Package for R

Teradata® Package for R User Guide

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:mapPath
yih1585763700215.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
B700-4005
Product Category
Teradata Vantage

Use the td_setup_sandbox_env() function to load a sandbox image and start a new container by passing the sandbox.image.location and sandbox.image.name arguments, or start an existing container using the container argument.

  • Connection must be established to run this function.
  • Teradata recommends running this function once before running the Script function td_test_script() on object of class "ScriptTableOperator".
  • Sandbox image loading on user's system is skipped if the image with the same name is already loaded.
  • At any given point, only one container can be started from within tdplyr.
  • At the end of a session, the image loaded and the container started by this function is cleaned up.

    If the image loading is skipped, then the image is not cleaned up.

  • Use td_cleanup_sandbox_env() to manually clean up the image and container started by this function.

    If the image loading is skipped, then the image is not cleaned up.

User should be careful when providing sandbox.image.location and sandbox.image.name.
If an incorrect sandbox.image.name is provided that does not match the name and tag of the image to be loaded, then:
  • The image will not be loaded. User should re-run the function with correct sandbox.image.name.
  • If the user's system already has an image with the same image name and tag as the image specified in sandbox.image.location, then the new image will be loaded and it will replace the old image.

Example 1: Load a sandbox image and start a new container

This example loads an image from the location specified in the sandbox.image.location argument and starts a container. This is useful when the user wants to run user scripts in a new container created from a new docker image.

> td_setup_sandbox_env(sandbox.image.location = "<path_to_docker_image>/sto_sandbox_R3.5.1_sles12sp3.0.5.2_docker_image.1.0.0.tar.gz",
                       sandbox.image.name = "rstosandbox:1.0")
Loading image from '<path_to_docker_image>/sto_sandbox_R3.5.1_sles12sp3.0.5.2_docker_image.1.0.0.tar.gz'. It may take few minutes.
Image 'rstosandbox:1.0' loaded successfully.
Starting a container with 'rstosandbox:1.0' image.
Container 'r_t__container_1621879064463068' started successfully.

Example 2: Start an existing container

This example starts an existing container specified in the argument container.id. This is useful when the user wants to run user script in an existing container.

Assume that the container 'my_container' is created before running this example.

> td_setup_sandbox_env(container = "my_container")
Container 'my_container' started successfully.