Environment variables control how processes run in a system. The environment’s owner or primary user often sets these variables, which are stored securely and can hold sensitive information, such as credentials.
You can create your own or use Domino’s environment variables to add values to your runs. These variables must start with letters and can only include letters, numbers, and underscores.
Only project owners and model editors can change these variables. They are not connected to the version history of your project or model, so you can easily remove them if needed.
You can use the same variable in different places. When Domino loads a run or workspace, it pulls environment variables from these sources in this order:
-
Compute environment variables: provide user, project, and hardware information.
-
Project environment variables: these are defined in the Hardware & Environment tab of the project settings.
-
User-account environment variables: originate from the user’s profile starting a run.
Here is an example of the expected run results with the same variable in multiple places:
Place set | Run #1 | Run #2 | Run #3 |
---|---|---|---|
Compute Environment | A | A | A |
Project | - | B | B |
User Account | - | - | C |
Run Result | A | B | C |
Reserved variable names in Domino
Domino uses specific environment variables to configure and manage operations. These variables should not be defined at the user or project level. Here are a few examples:
-
USER
-
DOMINO_xyz
(Any variable that starts with DOMINO) -
LOGNAME
-
MLFLOW_TRACKING_URI
We recommend using a common prefix, such as YOUR COMPANY NAME_
for all custom environment variables to avoid collisions with Domino environment variables.
You must be the project owner to add, modify, or delete environment variables. These variables are stored securely and can hold sensitive information, such as credentials.
Only owners or editors can create environment variables. When you add a variable, the values are pushed to all running model versions.
-
Open your Project and click Settings.
-
In the Environment variables section, add the following:
-
Name: Enter the variable name. For example, DOMINO_USER_NAME.
-
Value: Enter a value for the variable. The maximum length for a value is 64K.
-
-
Click Set Variable.
You can send the values exactly as they are without adding escaping characters.
Create model variables
Only owners or editors can create environment variables. When you add a variable, the values are pushed to all running model versions.
Project-level and user-level environment variables are not used in models and must be set separately for each model.
-
Open your Model and click Settings.
-
In the Environment variables section, add the following:
-
Name: Enter the variable name. For example, DOMINO_USER_NAME.
-
Value: Enter a value for the variable. The maximum length for a value is 64K.
-
-
Click Set Variable.
You can set different environment variables for each user. The system injects these variables at execution time for any run initiated by that user.
User environment variables are automatically imported into runs for all projects. However, user-specific environment variables cannot be used in models.
-
Click Account > Account Settings to open the Account Settings page.
-
Choose User environment variables from the list.
-
In the Environment variables section, add the following:
-
Name: Enter the variable name. For example, DOMINO_USER_NAME.
-
Value: Enter a value for the variable. The maximum length for a value is 64K.
-
-
Click Set Variable.
You can send the values exactly as they are without adding escaping characters.
Connect to Git repositories
If you want to use a user-level environment variable to connect to GitHub and download repositories, you’ll need to do the following to your environment definition:
-
If needed, create a personal access token for GitHub.
-
Add the following to your environment definition:
RUN pip install git+https://username:personalaccesstoken@github.com/<repo>
Every language reads environment variables uniquely.
-
In Python, it might look like this:
import os
s3 = S3Client(os.environ['S3_KEY'], os.environ['S3_SECRET'])
Run this to retrieve an environment variable within your code for Python:
import os
os.environ['DOMINO_RUN_ID']
-
In R, it might look like this:
makeS3Client(Sys.getenv("S3_KEY"), Sys.getenv("S3_SECRET"))
Run this to retrieve an environment variable within your code for R:
Sys.getenv("DOMINO_RUN_ID")
Domino automatically injects the following environment variables whenever it runs your code as part of the context of your run.
Using these variables, you can create artifacts or results, such as a report mentioning the run number.
These variables are not available to use in the Model Manager.
-
DOMINO_USER_API_KEY
— This variable is sunsetting; use the API Proxy for Domino API authentication instead. -
DOMINO_API_HOST
— Use this to use the Domino API to access another project. -
DOMINO_PROJECT_OWNER
— Username of the owner of the running project. -
DOMINO_PROJECT_NAME
— Name of the running project. -
DOMINO_RUN_ID
— Run ID of the current run. -
DOMINO_RUN_NUMBER
— Run number of the current run. -
DOMINO_HARDWARE_TIER_ID
- Hardware tier the current run is executing on (new in v1.42). -
DOMINO_STARTING_USERNAME
- Username of the user who began the run (new in v1.43). -
DOMINO_WORKING_DIR
- Working directory for the running project. -
AWS_SHARED_CREDENTIALS_FILE
- Path to your AWS credential file to connect to additional AWS resources (for example, S3, Redshift). See AWS credential propagation. -
DOMINO_TOKEN_FILE
- DOMINO_TOKEN_FILE no longer exists as an environment variable. Instead, Use a Token for Authentication. -
DOMINO_USER_NAME
— Domino Username of the person running the Workspace/Job. -
DOMINO_PROJECT_ID
— Project ID of the current project. -
DOMINO_IS_GIT_BASED
— Boolean value indicating if the Project is Git-based. -
DOMINO_IS_WORKFLOW_JOB
— Boolean value indicating if the workflow is a job. -
DOMINO_IS_LOCAL_DATA_PLANE
— Boolean value indicating if Datasets are associated with a local data plane. -
DOMINO_DATASETS_DIR
— Directory where Datasets are accessed. -
DOMINO_IMPORTED_DATA_DIR
— Directory where imported Datasets are accessed. -
DOMINO_ARTIFACTS_DIR
— Directory where Artifacts files system is accessed. -
DOMINO_IMPORTED_ARTIFACTS_DIR
— Directory where imported Artifacts file systems are accessed. -
DOMINO_IMPORTED_CODE_DIR
— Directory where imported code repositories are accessed. -
DOMINO_TRAINING_SET_PATH
— Directory where Domino Model Monitoring training sets are accessed. -
DOMINO_USER
— Value of the default Linux username in the container, i.e.ubuntu
. -
DOMINO_USER_ID
— Value of the default Linux user ID in the container, i.e.12674
. -
DOMINO_GROUP
— Value of the default Linux group name in the container, i.e.ubuntu
. -
DOMINO_GROUP_ID
— Value of default Linux group ID in the container, i.e.12574
. -
DOMINO_NODE_IP
— The compute node IP. -
DOMINO_NODE_NAME
— Name of the compute node.