2021-05-13 23:48:51 +00:00
---
title: Storage
---
2021-05-18 22:31:01 +00:00
2021-05-19 00:12:21 +00:00
ClearML is able to interface with the most popular storage solutions in the market for storing model checkpoints, artifacts
2021-05-13 23:48:51 +00:00
and charts.
Supported storage mediums include:
2021-06-20 22:00:16 +00:00
![image ](../../static/icons/ClearML_Supported_Storage--on-light.png )
2021-05-13 23:48:51 +00:00
:::note
Once uploading an object to a storage medium, each machine that uses the object must have access to it.
:::
## Configuring Storage
Configuration for storage is done by editing the [clearml.conf ](../configs/clearml_conf.md ).
2021-10-21 06:44:30 +00:00
The ClearML configuration file uses [HOCON ](https://github.com/lightbend/config/blob/main/HOCON.md ) format, which supports runtime environment variable access.
2021-05-13 23:48:51 +00:00
### Configuring AWS S3
Modify these parts of the clearml.conf file and add the key, secret, and region of the s3 bucket.
2022-04-13 08:45:35 +00:00
It's possible to also give access to specific s3 buckets.
You can also enable using a credentials chain to let Boto3
pick the right credentials. This includes picking credentials from environment variables, a credential file, and metadata service
with an IAM role configured. See [Boto3 documentation ](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials ).
2021-05-13 23:48:51 +00:00
```
aws {
2021-12-02 17:56:33 +00:00
s3 {
# S3 credentials, used for read/write access by various SDK elements
# default, used for any bucket not specified below
key: ""
secret: ""
region: ""
credentials: [
# specifies key/secret credentials to use when handling s3 urls (read or write)
{
bucket: "my-bucket-name"
key: ""
secret: ""
verify: "/path/to/ca/bundle.crt" OR false to not verify
2022-04-13 08:45:35 +00:00
use_credentials_chain: false
2021-12-02 17:56:33 +00:00
},
2021-10-05 06:02:44 +00:00
2021-12-02 17:56:33 +00:00
]
}
boto3 {
pool_connections: 512
max_multipart_concurrency: 16
2021-05-13 23:48:51 +00:00
}
2021-12-02 17:56:33 +00:00
}
2021-05-13 23:48:51 +00:00
```
2021-10-21 06:44:30 +00:00
AWS's S3 access parameters can be specified by referencing the standard environment variables if already defined.
For example:
```
2021-12-02 17:56:33 +00:00
aws {
s3 {
2021-10-21 06:44:30 +00:00
# default, used for any bucket not specified below
2021-12-30 15:30:09 +00:00
key: ${AWS_ACCESS_KEY_ID}
secret: ${AWS_SECRET_ACCESS_KEY}
region: ${AWS_DEFAULT_REGION}
2021-12-02 17:56:33 +00:00
}
2021-10-21 06:44:30 +00:00
}
```
2021-05-13 23:48:51 +00:00
ClearML also supports [MinIO ](https://github.com/minio/minio ) by adding this configuration:
```
2021-12-02 17:56:33 +00:00
aws {
s3 {
# default, used for any bucket not specified below
key: ""
secret: ""
region: ""
2021-05-13 23:48:51 +00:00
2021-12-02 17:56:33 +00:00
credentials: [
{
# This will apply to all buckets in this host (unless key/value is specifically provided for a given bucket)
host: "my-minio-host:9000"
key: ""
secret: ""
multipart: false
secure: false
}
]
}
}
2021-11-29 07:39:36 +00:00
```
2021-10-21 06:44:30 +00:00
2021-12-02 17:56:33 +00:00
:::info non-AWS Endpoints
To force usage of a non-AWS endpoint (like the MinIO example above), port declaration is *always* needed, even if standard.
To enable TLS, pass `secure: true` .
:::
2021-05-13 23:48:51 +00:00
### Configuring Azure
To configure Azure blob storage specify the account name and key.
```
2021-12-02 17:56:33 +00:00
azure.storage {
containers: [
{
account_name: ""
account_key: ""
# container_name:
}
]
}
2021-05-13 23:48:51 +00:00
```
2021-10-21 06:44:30 +00:00
Azure's storage access parameters can be specified by referencing the standard environment variables if already defined.
For example:
```
2021-12-02 17:56:33 +00:00
azure.storage {
containers: [
{
2021-12-30 15:30:09 +00:00
account_name: ${AZURE_STORAGE_ACCOUNT}
account_key: ${AZURE_STORAGE_KEY}
2021-12-02 17:56:33 +00:00
# container_name:
}
]
}
2021-10-21 06:44:30 +00:00
```
2021-05-13 23:48:51 +00:00
### Configuring Google Storage
To configure Google Storage, specify the project and the path to the credentials json file.
It's also possible to specify credentials for a specific bucket.
```
2021-12-02 17:56:33 +00:00
google.storage {
# Default project and credentials file
# Will be used when no bucket configuration is found
project: "clearml"
credentials_json: "/path/to/credentials.json"
# Specific credentials per bucket and sub directory
credentials = [
{
bucket: ""
subdir: "path/in/bucket" # Not required
project: ""
credentials_json: "/path/to/credentials.json"
},
]
}
2021-05-13 23:48:51 +00:00
```
2021-10-21 06:44:30 +00:00
GCP's storage access parameters can be specified by referencing the standard environment variables if already defined.
```
2021-12-02 17:56:33 +00:00
google.storage {
credentials = [
{
bucket: ""
subdir: "path/in/bucket" # Not required
project: ""
2021-12-30 15:30:09 +00:00
credentials_json: ${GOOGLE_APPLICATION_CREDENTIALS}
2021-12-02 17:56:33 +00:00
},
]
}
2021-10-21 06:44:30 +00:00
```
2021-05-13 23:48:51 +00:00
## Storage Manager
2021-09-01 06:41:27 +00:00
ClearML offers the [StorageManager ](../references/sdk/storage.md ) class to manage downloading, uploading, and caching of
content directly from code.
2021-05-13 23:48:51 +00:00
2021-09-01 06:41:27 +00:00
See [Storage Examples ](../guides/storage/examples_storagehelper.md ).
2021-05-13 23:48:51 +00:00
## Caching
2021-05-19 00:12:21 +00:00
ClearML also manages a cache of all downloaded content so nothing is duplicated, and code won't need to download the same
2021-05-13 23:48:51 +00:00
piece twice!
Configure cache location by modifying the [clearml.conf ](../configs/clearml_conf.md ) file:
```
storage {
2021-12-02 17:56:33 +00:00
cache {
# Defaults to system temp folder / cache
default_base_dir: "~/.clearml/cache"
2021-05-13 23:48:51 +00:00
}
2021-12-02 17:56:33 +00:00
direct_access: [
# Objects matching are considered to be available for direct access, i.e. they will not be downloaded
# or cached, and any download request will return a direct reference.
# Objects are specified in glob format, available for url and content_type.
{ url: "file://*" } # file-urls are always directly referenced
]
}
2021-05-13 23:48:51 +00:00
```
### Direct Access
2021-10-05 06:02:44 +00:00
By default, all artifacts (Models / Artifacts / Datasets) are automatically downloaded to the cache before they're used.
Some storage mediums (NFS / Local storage) allows for direct access,
which means that the code would work with the object where it's originally stored and not downloaded to cache first.
2021-05-13 23:48:51 +00:00
To enable direct access, specify the urls to access directly.