Settings allow you to customize how mlop behaves during initialization and runtime. You can configure settings through environment variables or by passing parameters directly to mlop.init().
Performance: mlop is designed to be fast and non-blocking. Settings allow you to customize behavior without impacting your training performance.
Source: These settings are available in mlop version 0.1.0+. Make sure you’re using the latest version: pip install "trainy-mlop-nightly[full]"
List of Environment Variables
Configure mlop behavior by setting these environment variables before running your script:
| Variable | Type | Description |
|---|
MLOP_DEBUG_LEVEL | str/int | Controls logging verbosity. Accepts: DEBUG, INFO, WARNING, ERROR, CRITICAL (case-insensitive) or numeric values (10, 20, 30, 40, 50) |
MLOP_URL_APP | str | Override the default application URL (default: https://trakkur.trainy.ai) |
MLOP_URL_API | str | Override the default API URL (default: https://trakkur-api.trainy.ai) |
MLOP_URL_INGEST | str | Override the default ingest URL (default: https://trakkur-ingest.trainy.ai) |
MLOP_URL_PY | str | Override the default Python API URL (default: https://trakkur-py.trainy.ai) |
Setting Environment Variables
Option 1: Export in Shell
Set environment variables before running your Python script:
export MLOP_DEBUG_LEVEL=DEBUG
export MLOP_URL_APP=https://custom-trakkur.example.com
python train.py
Option 2: Inline with Command
MLOP_DEBUG_LEVEL=INFO python train.py
Option 3: In Python Script
import os
os.environ['MLOP_DEBUG_LEVEL'] = 'DEBUG'
import mlop
run = mlop.init(project="my-project", name="experiment-1")
When setting environment variables in Python, make sure to set them before importing mlop for them to take effect.
Customizing Settings via Code
You can also pass settings directly when initializing mlop, which will override environment variables.
mlop logger officially supports customizing the following settings:
| Parameter | Type | Description |
|---|
host | str | Set the host address for the logger for self-hosted instances. |
disable_iface | bool | Disable the network interface exposed to the logger. |
disable_store | bool | Disable the local data store. |
x_sys_label | str | Set the log group label for system metrics. |
x_grad_label | str | Set the log group label for model gradients. |
x_param_label | str | Set the log group label for model parameters. |
x_sys_sampling_interval | int | Set the sampling interval for the system metrics. |
x_log_level | int | Set the log level for the logger. |
x_file_stream_max_conn | int | Set the maximum number of connections allowed for API calls. |
x_file_stream_max_size | int | Set the maximum size of individual connections. |
x_file_stream_timeout_seconds | int | Set the timeout in seconds for individual connections. |
x_file_stream_retry_max | int | Set the maximum number of retries for REST API calls. |
x_file_stream_retry_wait_min_seconds | int | Set the minimum wait time in seconds between retries. |
x_file_stream_retry_wait_max_seconds | int | Set the maximum wait time in seconds between retries. |
Using Dictionary
import mlop
settings = {
'x_log_level': 10, # DEBUG level
'url_app': 'https://custom-trakkur.example.com',
'url_api': 'https://custom-api.example.com'
}
run = mlop.init(
project="my-project",
name="experiment-1",
settings=settings
)
Using Settings Object
import mlop
settings = mlop.Settings()
settings.x_log_level = 10 # DEBUG level
settings.url_app = 'https://custom-trakkur.example.com'
run = mlop.init(
project="my-project",
name="experiment-1",
settings=settings
)
Debug Levels
The MLOP_DEBUG_LEVEL environment variable controls how much logging information mlop outputs:
| Level | Value | Use Case |
|---|
DEBUG | 10 | Detailed diagnostic information, enables failed request logging |
INFO | 20 | Confirmation that things are working as expected |
WARNING | 30 | Something unexpected happened, but still working |
ERROR | 40 | More serious problem, some functionality may not work |
CRITICAL | 50 | Serious error, program may not be able to continue |
Default: INFO (20)
Failed Request Logging
When MLOP_DEBUG_LEVEL is set to DEBUG, mlop automatically logs failed requests to:
~/.mlop/failed_requests.log
Each failed request entry includes:
- Timestamp (UTC)
- Request type and URL
- Payload information
- Error details
- Number of retries attempted
This is useful for debugging network issues or investigating why certain metrics weren’t logged.
URL Configuration
Override default Trakkur URLs for:
- Self-hosted deployments: Point mlop to your own infrastructure
- Development/staging environments: Test against non-production servers
Settings Precedence
When the same setting is specified in multiple places, mlop uses this priority order (highest to lowest):
- Direct parameters to
mlop.init(settings=...)
- Environment variables (
MLOP_*)
- Default values
Example
# Environment: MLOP_DEBUG_LEVEL=WARNING
import mlop
# This will use DEBUG (parameter overrides environment variable)
run = mlop.init(
project="my-project",
settings={'x_log_level': 10} # DEBUG
)
Common Use Cases
Debugging Failed Uploads
export MLOP_DEBUG_LEVEL=DEBUG
python train.py
# Check ~/.mlop/failed_requests.log for details