Teradata Package for Python Function Reference on VantageCloud Lake - remove_all_envs - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.
Teradata® Package for Python Function Reference on VantageCloud Lake
- Deployment
- VantageCloud
- Edition
- Lake
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Lake_2000
- Product Category
- Teradata Vantage
- teradataml.scriptmgmt.lls_utils.remove_all_envs = remove_all_envs(env_type=None, **kwargs)
- DESCRIPTION:
Removes user environments from the Open Analytics Framework. Function allows user
to remove only Python user environments or only R user environments or all user
environments based on the value passed to argument "env_type".
Note:
* Do not execute remove_all_envs() if any of the library management functions(install_lib()
/uninstall_lib()/update_lib()) are being executed on any environment.
PARAMETERS:
env_type:
Optional Argument.
Specifies the type of the user environment to be removed.
Permitted Values:
* 'PY' - Remove only Python user environments.
* 'R' - Remove only R user environments.
* None - Remove all (Python and R) user environments.
Default Value: None
Types: str
kwargs:
asynchronous:
Optional Argument.
Specifies whether to remove environment synchronously or
asynchronously.
Default Value: False
Types: bool
RETURNS:
True when
* Operation is synchronous.
* Operation is asynchronous with "env_type".
str otherwise.
RAISES:
TeradataMlException, RuntimeError.
EXAMPLES:
# Example 1: Remove all the Python and R user environments.
>>> create_env('Lie_Detection_ML', 'python_3.8.13', 'Detect lie through machine learning.')
>>> create_env('Customer_Trends', 'r_4.1.3', 'Analyse customer trends.')
>>> list_user_envs()
env_name env_description base_env_name language
0 Customer_Trends Analyse customer trends r_4.1.3 R
1 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python
>>> remove_all_envs()
All user environment(s) removed.
True
>>> list_user_envs()
No user environment(s) found.
# Example 2: Remove all the Python user environments.
>>> create_env('Lie_Detection_ML', 'python_3.8.13', 'Detect lie through machine learning.')
>>> create_env('Customer_Trends', 'r_4.1.3', 'Analyse customer trends.')
>>> list_user_envs()
env_name env_description base_env_name language
0 Customer_Trends Analyse customer trends r_4.1.3 R
1 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python
>>> remove_all_envs(env_type="PY")
User environment 'Lie_Detection_ML' removed.
All Python environment(s) removed.
True
>>> list_user_envs()
env_name env_description base_env_name language
0 Customer_Trends Analyse customer trends r_4.1.3 R
# Example 3: Remove all the R user environments.
>>> create_env('Lie_Detection_ML', 'python_3.8.13', 'Detect lie through machine learning.')
>>> create_env('Customer_Trends', 'r_4.1.3', 'Analyse customer trends.')
>>> list_user_envs()
env_name env_description base_env_name language
0 Customer_Trends Analyse customer trends r_4.1.3 R
1 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python
>>> remove_all_envs(env_type="R")
User environment 'Customer_Trends' removed.
All R environment(s) removed.
True
>>> list_user_envs()
env_name env_description base_env_name language
0 Lie_Detection_ML Detect lie through machine learning. python_3.8.13 Python
# Example 4: Remove all Python and R environments synchronously.
# Note: The example first removes all R environments synchronously,
# followed by Python environments.
>>> env1 = create_env("env1", "python_3.7.13", "Environment 1")
>>> env2 = create_env("env2", "python_3.7.13", "Environment 2")
>>> env3 = create_env("env3", "r_4.1", "Environment 3")
>>> env4 = create_env("env4", "r_4.1", "Environment 4")
>>> list_user_envs()
env_name env_description base_env_name language
0 env1 Environment 1 python_3.7.13 Python
1 env2 Environment 2 python_3.7.13 Python
2 env3 Environment 3 r_4.1 R
3 env4 Environment 4 r_4.1 R
# Remove all R environments.
>>> remove_all_envs(env_type="R")
User environment 'env3' removed.
User environment 'env4' removed.
All R environment(s) removed.
True
>>> list_user_envs()
env_name env_description base_env_name language
0 env1 Environment 1 python_3.7.13 Python
1 env2 Environment 2 python_3.7.13 Python
# Try to remove R environments again.
>>> remove_all_envs(env_type="R")
No R user environment(s) found.
True
# Remove all remaining Python environments.
>>> remove_all_envs()
All user environment(s) removed.
True
# Example 5: Remove all Python and R environments asynchronously.
# Note: The example first removes all R environments asynchronously,
# followed by Python environments.
>>> env1 = create_env("env1", "python_3.7.13", "Environment 1")
>>> env2 = create_env("env2", "python_3.7.13", "Environment 2")
>>> env3 = create_env("env3", "r_4.1", "Environment 3")
>>> env4 = create_env("env4", "r_4.1", "Environment 4")
>>> list_user_envs()
env_name env_description base_env_name language
0 env1 Environment 1 python_3.7.13 Python
1 env2 Environment 2 python_3.7.13 Python
2 env3 Environment 3 r_4.1 R
3 env4 Environment 4 r_4.1 R
# Remove all R environments asynchronously.
>>> remove_all_envs(env_type="R", asynchronous=True)
Request to remove environment initiated successfully. Check the status using async_run_status(['5c23f956-c89a-4d69-9f1e-6491bac9973f', '6ec9ecc9-9223-4d3f-92a0-9d1abc652aca'])
True
>>> list_user_envs()
env_name env_description base_env_name language
0 env1 Environment 1 python_3.7.13 Python
1 env2 Environment 2 python_3.7.13 Python
# Remove all remaining Python environments asynchronously.
>>> remove_all_envs(asynchronous=True)
Request to remove environment initiated successfully. Check the status using async_run_status('7d86eb99-9ab3-4e0d-b4dd-8b5f1757b9c7')
'7d86eb99-9ab3-4e0d-b4dd-8b5f1757b9c7'
# Example 6: Remove all environments asynchronously.
>>> env1 = create_env("env1", "python_3.7.13", "Environment 1")
>>> env2 = create_env("env2", "python_3.7.13", "Environment 2")
>>> env3 = create_env("env3", "r_4.1", "Environment 3")
>>> env4 = create_env("env4", "r_4.1", "Environment 4")
>>> list_user_envs()
env_name env_description base_env_name language
0 env1 Environment 1 python_3.7.13 Python
1 env2 Environment 2 python_3.7.13 Python
2 env3 Environment 3 r_4.1 R
3 env4 Environment 4 r_4.1 R
# Remove all environments asynchronously.
>>> remove_all_envs(asynchronous=True)
Request to remove environment initiated successfully. Check the status using async_run_status('22f5d693-38d2-469e-b434-9f7246c7bbbb')
'22f5d693-38d2-469e-b434-9f7246c7bbbb'