Environment
This class represents an environment configuration, defining its name, Docker image, resource allocation, environment variables, secrets, and dependencies. It supports automatic image selection and allows for defining explicit dependencies on other environments to manage deployment order. The class also includes validation for environment names and type checking for its parameters during initialization.
Attributes
-
name: string
- Name of the environment
-
depends_on: List[Environment] = field(default_factory=list)
- Environment dependencies to hint, so when you deploy the environment, the dependencies are also deployed. This is useful when you have a set of environments that depend on each other.
-
pod_template: Optional[Union[str, "V1PodTemplate"]] = None
- None
-
description: Optional[str] = None
- None
-
secrets: Optional[SecretRequest] = None
- None
-
env_vars: Optional[Dict[str, str]] = None
- None
-
resources: Optional[Resources] = None
- None
-
image: Union[str, Image, Literal["auto"]] = "auto"
- Docker image to use for the environment. If set to "auto", will use the default image.
Constructors
-
Initializes an Environment object.
-
Parameters
- name: str
- Name of the environment
- image: Union[str, Image, Literal["auto"]]
- Docker image to use for the environment. If set to "auto", will use the default image.
- resources: Optional[Resources]
- Resources to allocate for the environment.
- env_vars: Optional[Dict[str, str]]
- Environment variables to set for the environment.
- secrets: Optional[SecretRequest]
- Secrets to inject into the environment.
- depends_on: Optional[List[Environment]]
- Environment dependencies to hint, so when you deploy the environment, the dependencies are also deployed. This is useful when you have a set of environments that depend on each other.
- pod_template: Optional[Union[str, "V1PodTemplate"]]
- Pod template for the environment.
- description: Optional[str]
- Description of the environment.
- name: str
Methods
def add_dependency(env: [Environment](src_flyte__environment_environment))
-
Add a dependency to the environment.
-
Parameters
- env: Environment
- Environment(s) to add as dependencies.
- env: Environment
def clone_with(name: str, image: Optional[Union[str, [Image](src_flyte__image_image), Literal["auto"]]] = None, resources: Optional[[Resources](src_flyte__resources_resources)] = None, env_vars: Optional[Dict[str, str]] = None, secrets: Optional[SecretRequest] = None, depends_on: Optional[List[[Environment](src_flyte__environment_environment)]] = None, kwargs: Any) - > [Environment](src_flyte__environment_environment)
-
Creates a new environment instance with updated attributes.
-
Parameters
- name: str
- The name of the new environment.
- image: Optional[Union[str, Image, Literal["auto"]]]
- The Docker image to use for the new environment.
- resources: Optional[Resources]
- Resources to allocate for the new environment.
- env_vars: Optional[Dict[str, str]]
- Environment variables to set for the new environment.
- secrets: Optional[SecretRequest]
- Secrets to inject into the new environment.
- depends_on: Optional[List[Environment]]
- Environment dependencies for the new environment.
- kwargs: Any
- Additional keyword arguments.
- name: str
-
Return Value: Environment
- A new Environment instance with the specified modifications.