Skip to main content
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:
VariableTypeDescription
MLOP_DEBUG_LEVELstr/intControls logging verbosity. Accepts: DEBUG, INFO, WARNING, ERROR, CRITICAL (case-insensitive) or numeric values (10, 20, 30, 40, 50)
MLOP_URL_APPstrOverride the default application URL (default: https://trakkur.trainy.ai)
MLOP_URL_APIstrOverride the default API URL (default: https://trakkur-api.trainy.ai)
MLOP_URL_INGESTstrOverride the default ingest URL (default: https://trakkur-ingest.trainy.ai)
MLOP_URL_PYstrOverride 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:
ParameterTypeDescription
hoststrSet the host address for the logger for self-hosted instances.
disable_ifaceboolDisable the network interface exposed to the logger.
disable_storeboolDisable the local data store.
x_sys_labelstrSet the log group label for system metrics.
x_grad_labelstrSet the log group label for model gradients.
x_param_labelstrSet the log group label for model parameters.
x_sys_sampling_intervalintSet the sampling interval for the system metrics.
x_log_levelintSet the log level for the logger.
x_file_stream_max_connintSet the maximum number of connections allowed for API calls.
x_file_stream_max_sizeintSet the maximum size of individual connections.
x_file_stream_timeout_secondsintSet the timeout in seconds for individual connections.
x_file_stream_retry_maxintSet the maximum number of retries for REST API calls.
x_file_stream_retry_wait_min_secondsintSet the minimum wait time in seconds between retries.
x_file_stream_retry_wait_max_secondsintSet 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:
LevelValueUse Case
DEBUG10Detailed diagnostic information, enables failed request logging
INFO20Confirmation that things are working as expected
WARNING30Something unexpected happened, but still working
ERROR40More serious problem, some functionality may not work
CRITICAL50Serious 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):
  1. Direct parameters to mlop.init(settings=...)
  2. Environment variables (MLOP_*)
  3. 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