Stack
zenml.cli.stack
CLI for manipulating ZenML local and global config file.
set_active_stack(stack_name, global_profile=False)
Sets a stack as active.
If the '--global' flag is set, the global active stack will be set, otherwise the repository active stack takes precedence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stack_name |
str |
Unique name of the stack |
required |
global_profile |
bool |
If the stack should be created on the global profile |
False |
Source code in zenml/cli/stack.py
def set_active_stack(stack_name: str, global_profile: bool = False) -> None:
"""Sets a stack as active.
If the '--global' flag is set, the global active stack will be set,
otherwise the repository active stack takes precedence.
Args:
stack_name: Unique name of the stack
global_profile: If the stack should be created on the global profile
"""
cli_utils.print_active_profile()
scope = " global" if global_profile else ""
repo = Repository()
with console.status(
f"Setting the{scope} active stack to '{stack_name}'..."
):
if global_profile:
repo.active_profile.activate_stack(stack_name)
else:
repo.activate_stack(stack_name)
cli_utils.declare(f"Active{scope} stack set to: '{stack_name}'")