From b377e940aadb359443bd01071315e582d5b689e3 Mon Sep 17 00:00:00 2001
From: pollfly <75068813+pollfly@users.noreply.github.com>
Date: Sun, 4 Aug 2024 18:43:02 +0300
Subject: [PATCH] Fix CLEARML_LOG_ENVIRONMENT info (#887)
---
docs/configs/clearml_conf.md | 2 +-
docs/configs/env_vars.md | 2 +-
docs/faq.md | 17 ++++++++++++++---
docs/fundamentals/hyperparameters.md | 26 ++++++++++++++++++++------
docs/webapp/webapp_exp_track_visual.md | 7 ++++++-
docs/webapp/webapp_exp_tuning.md | 3 ++-
6 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/docs/configs/clearml_conf.md b/docs/configs/clearml_conf.md
index 66241b05..2be7edfd 100644
--- a/docs/configs/clearml_conf.md
+++ b/docs/configs/clearml_conf.md
@@ -1044,7 +1044,7 @@ and limitations on bucket naming.
Multiple selected variables are supported including the suffix "\*". For example: "AWS\_\*" will log any OS environment
variable starting with "AWS\_". Example: `log_os_environments: ["AWS_*", "CUDA_VERSION"]`
-* This value can be overwritten with OS environment variable `CLEARML_LOG_ENVIRONMENT="[AWS_*, CUDA_VERSION]"`.
+* This value can be overwritten with OS environment variable `CLEARML_LOG_ENVIRONMENT=AWS_*,CUDA_VERSION`.
---
diff --git a/docs/configs/env_vars.md b/docs/configs/env_vars.md
index 77c48a98..a8c64a17 100644
--- a/docs/configs/env_vars.md
+++ b/docs/configs/env_vars.md
@@ -17,7 +17,7 @@ but can be overridden by command-line arguments.
### General
|Name| Description |
|---|--------------------------------------------------------------------------------|
-|**CLEARML_LOG_ENVIRONMENT** | List of Environment variable names. These environment variables will be logged in the ClearML task's configuration hyperparameters `Environment` section. When executed by a ClearML agent, these values will be set in the task's execution environment. |
+|**CLEARML_LOG_ENVIRONMENT** | List of Environment variable names. These environment variables will be logged in the ClearML task's configuration hyperparameters `Environment` section. When executed by a ClearML agent, these values will be set in the task's execution environment. The list should be specified in the following format: `CLEARML_LOG_ENVIRONMENT=VAR_1,VAR_2`. |
|**CLEARML_TASK_NO_REUSE** | Boolean.
When set to `1`, a new task is created for every execution (see Task [reuse](../clearml_sdk/task_sdk.md#task-reuse)). |
|**CLEARML_CACHE_DIR** | Set the path for the ClearML cache directory, where ClearML stores all downloaded content. |
|**CLEARML_DOCKER_IMAGE** | Sets the default docker image to use when running an agent in [Docker mode](../clearml_agent/clearml_agent_execution_env.md#docker-mode). |
diff --git a/docs/faq.md b/docs/faq.md
index 1606771a..3ca5e9b4 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -854,18 +854,25 @@ export CLEARML_API_HOST="http://localhost:8008"
#### How can I track OS environment variables with experiments?
-Set the OS environment variable `CLEARML_LOG_ENVIRONMENT` with the variables you need track, either:
+You can set environment variables to track in an experiment by specifying them in the `sdk.development.log_os_environments`
+field of the [`clearml.conf`](configs/clearml_conf.md) file:
+
+```editorconfig
+log_os_environments: ["AWS_*", "CUDA_VERSION"]
+```
+
+You can also use the `CLEARML_LOG_ENVIRONMENT` variable to track environment variables:
* All environment variables:
```
- export CLEARML_LOG_ENVIRONMENT="*"
+ export CLEARML_LOG_ENVIRONMENT=*
```
* Specific environment variables, for example, log `PWD` and `PYTHONPATH`:
```
- export CLEARML_LOG_ENVIRONMENT="PWD,PYTHONPATH"
+ export CLEARML_LOG_ENVIRONMENT=PWD,PYTHONPATH
```
* No environment variables:
@@ -874,6 +881,10 @@ Set the OS environment variable `CLEARML_LOG_ENVIRONMENT` with the variables you
export CLEARML_LOG_ENVIRONMENT=
```
+:::note Overriding clearml.conf
+The `CLEARML_LOG_ENVIRONMENT` variable always overrides the `clearml.conf` file.
+:::
+
## ClearML Hosted Service
#### I run my script, but my experiment is not in the ClearML Hosted Service Web UI. How do I fix this?
diff --git a/docs/fundamentals/hyperparameters.md b/docs/fundamentals/hyperparameters.md
index 3ae7d9a4..4b6069b9 100644
--- a/docs/fundamentals/hyperparameters.md
+++ b/docs/fundamentals/hyperparameters.md
@@ -43,20 +43,34 @@ Relying on environment variables makes an experiment not fully reproducible, sin
runtime.
:::
-Environment variables can be logged by modifying the [clearml.conf](../configs/clearml_conf.md) file. Modify the `log_os_environments`
-parameter specifying parameters to log.
+Environment variables can be logged to a task by specifying the variables in the `sdk.development.log_os_environments`
+field of the [`clearml.conf`](../configs/clearml_conf.md) file:
```editorconfig
log_os_environments: ["AWS_*", "CUDA_VERSION"]
```
-You can also specify environment variables using the `CLEARML_LOG_ENVIRONMENT` variable.
-
+You can also specify environment variables using the `CLEARML_LOG_ENVIRONMENT` environment variable:
+* All environment variables:
+ ```
+ export CLEARML_LOG_ENVIRONMENT=*
+ ```
+
+* Specific environment variables. For example, log `PWD` and `PYTHONPATH`:
+ ```
+ export CLEARML_LOG_ENVIRONMENT=PWD,PYTHONPATH
+ ```
+
+* No environment variables
+ ```
+ export CLEARML_LOG_ENVIRONMENT=
+ ```
+
:::note Overriding clearml.conf
-The `CLEARML_LOG_ENVIRONMENT` always overrides the `clearml.conf` file.
+The `CLEARML_LOG_ENVIRONMENT` variable always overrides the `clearml.conf` file.
:::
-When a script that has integrated ClearML is executed, the environment variables listed in `clearml.conf` or specified by
+When a script that has integrated ClearML is executed, the environment variables listed in the `clearml.conf` or specified by
the `CLEARML_LOG_ENVIRONMENT` variable are logged by ClearML.
### Explicit Logging
diff --git a/docs/webapp/webapp_exp_track_visual.md b/docs/webapp/webapp_exp_track_visual.md
index 1b613ae7..d1b503b7 100644
--- a/docs/webapp/webapp_exp_track_visual.md
+++ b/docs/webapp/webapp_exp_track_visual.md
@@ -122,7 +122,12 @@ parameter's line, and the type, description, and default value appear, if they w
#### Environment Variables
-If the `CLEARML_LOG_ENVIRONMENT` variable was set, the **Environment** group will show environment variables (see [this FAQ](../faq.md#track-env-vars)).
+If environment variables were listed in the `CLEARML_LOG_ENVIRONMENT` environment variable or the `sdk.development.log_os_environments`
+field of the `clearml.conf` file, the **Environment** group displays the listed environment variables (see [this FAQ](../faq.md#track-env-vars)).
+
+:::note
+The `CLEARML_LOG_ENVIRONMENT` variable always overrides the `clearml.conf` file.
+:::

diff --git a/docs/webapp/webapp_exp_tuning.md b/docs/webapp/webapp_exp_tuning.md
index a1e6490e..21b0df6d 100644
--- a/docs/webapp/webapp_exp_tuning.md
+++ b/docs/webapp/webapp_exp_tuning.md
@@ -117,7 +117,8 @@ Add, change, or delete hyperparameters, which are organized in the **ClearML Web
* **General** - Parameter dictionaries (from code, connected to the Task by calling [`Task.connect()`](../references/sdk/task.md#connect)).
-* Environment variables - Tracked if the `CLEARML_LOG_ENVIRONMENT` environment variable was set (see this [FAQ](../faq.md#track-env-vars)).
+* Environment variables - Tracked if variables were listed in the `CLEARML_LOG_ENVIRONMENT` environment variable
+or the `sdk.development.log_os_environments` field of the `clearml.conf` file (see this [FAQ](../faq.md#track-env-vars)).
* Custom named parameter groups (see the `name` parameter in [`Task.connect`](../references/sdk/task.md#connect)).