Teradata Package for R Function Reference | 17.00 - td_cleanup_sandbox_env - Teradata Package for R - Look here for syntax, methods and examples for the functions included in the Teradata Package for R.

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:id
B700-4007
NMT
no
Product Category
Teradata Vantage
Cleanup Sandbox Environment

Description

Function to remove the container and/or docker image set up using the function td_setup_sandbox_env().
Notes:

  1. Docker image loaded by the td_setup_sandbox_env() function is not removed if there is another container created from the same image. If there is no other container, then image is cleaned up.

  2. If user creates a container 'container_1' without using td_setup_sandbox_env() function and sets the option 'sandbox.container' with this value, then td_cleanup_sandbox_env() function does not remove the container 'container_1' and image associated with it. Onus is on the user to remove the image and associated container manually.

  3. If user sets the option 'sandbox.container' manually and runs td_setup_sandbox_env() later, then this function resets the option 'sandbox.container' to NULL and performs the cleanup of the container/image created/loaded by td_setup_sandbox_env() function.

  4. If user runs td_setup_sandbox_env() function and then sets the option 'sandbox.container' manually to a different container, then this function cleans up the container/image created/loaded by td_setup_sandbox_env() function, but the value of option 'sandbox.container' remains the same.

  5. Removing the context or ending the session also performs cleanup similar to this function.

  6. To see if there are any issues while dropping the container and/or image, the user can set the option 'td.debug.enable' to TRUE.

Usage

td_cleanup_sandbox_env()

Value

TRUE, invisibly.

Examples


# Get remote data source connection.
con <- td_get_context()$connection

# Example 1: Setup sandbox environment using td_setup_sandbox_env() function
#            and clean it up using td_cleanup_sandbox_env() function.
#            This cleans up image and container created by
#            td_setup_sandbox_env().
td_setup_sandbox_env(sandbox.image.location = "<path_to_docker_image>",
                     sandbox.image.name = "rstosandbox:1.0")

td_cleanup_sandbox_env()

# Example 2: Setup sandbox environment using td_setup_sandbox_env() function
#            and clean it up using td_cleanup_sandbox_env() function. Then,
#            set the option 'sandbox.container' manually to a container
#            created from a image different from the one used in
#            td_setup_sandbox_env(). This only cleans up image and container
#            created by td_setup_sandbox_env() and does NOT clean up the
#            container specified in the option.
td_setup_sandbox_env(sandbox.image.location = "<path_to_docker_image>",
                     sandbox.image.name = "rstosandbox:1.0")

# "<container_1>" is the container NOT created using the image
# "rstosandbox:1.0".
option(sandbox.container = "<container_1>")

td_cleanup_sandbox_env()

# Example 3: Setup sandbox environment using the already created container
#            using td_setup_sandbox_env() function and the clean it up using
#            td_cleanup_sandbox_env() function. This cleans up only the
#            container setup by the td_setup_sandbox_env() function and does
#            NOT clean up the image as it is not loaded by the setup.
td_setup_sandbox_env(container = "<container_1>")

td_cleanup_sandbox_env()