Work with environment variables

An environment is the infrastructure used by the platform to store data and run computation. Once created, you can start working in the environments by creating pipelines and running them in the platform.

In addition, you can create and save environment variables that will allow you to parameterize certain variables in order to call them when running or deploying a pipeline.

Function name

Method

Return type

Description

create_or_update_environment_variable

CraftAiSdk.create_or_update_environment_variable (environment_variable_name, environment_variable_value)

dict

To create or update an environment variable available for all pipelines executions.

list_environment_variables

CraftAiSdk.list_environment_variables()

List of dict

Get a list of all environments variables in the current environment.

delete_environment_variable

CraftAiSdk.delete_environment_variable(environment_variable_name)

dict

Delete a specified environment variable.

Set up an environment variable

An environment variable is a value that can be passed to your step code. It is used to store information that may be needed by the operating system or by applications that run on the platform (for example, by endpoints you deploy on the platform).

Create and update an environment variable

To create or update an environment variable available for all pipelines executions.

CraftAiSdk.create_or_update_environment_variable(environment_variable_name,
environment_variable_value)

Parameters

  • environment_variable_name (str) – Name of the environment variable to create.

  • environment_variable_value (str) – Value of the environment variable to create.

Returns

A dict object containing the ID of environment variable (with keys “id”)

Get the list of environment variables

Get the list of all environment variables in the current environment.

CraftAiSdk.list_environment_variables()

Parameter

No parameter

Returns

List of dicts of environment variables (with keys “name” and “value”)

Delete an environment variable

Delete a specified environment variable.

CraftAiSdk.delete_environment_variable(environment_variable_name)

Parameter

  • environment_variable_name (str) – Name of the environment variable to delete.

Returns

Dict (with keys “name” and “value”) of the deleted environment variable