
Azure Machine Learning is Microsoft's cloud-native machine learning platform that provides experiment tracking, managed compute, pipelines, a model registry, and model serving as hosted services within the Azure ecosystem. It abstracts infrastructure management but ties teams to Azure-specific APIs, managed compute pricing, and Microsoft's tooling.
ClearML is an open-source MLOps platform that provides the same experiment tracking, pipeline orchestration, model registry, and serving capabilities as a self-hosted deployment on any infrastructure. It integrates with existing Python training code through automatic logging, removes dependency on Azure-managed compute, and stores all data within the team's own environment.
This article demonstrates how to deploy ClearML Server using Docker Compose with Traefik as a reverse proxy, configure agents for remote execution, and run machine learning workflows. It also explains how to track experiments, build pipelines, perform hyperparameter optimization, serve models with Triton, and migrate from Azure Machine Learning.
ClearML maps directly to Azure Machine Learning components, providing equivalent functionality through a self-hosted, cloud-agnostic platform.
The ClearML architecture consists of:
Before you begin, you need to:
app.clearml.example.com (Web UI), api.clearml.example.com (API server), and files.clearml.example.com (file server).The ClearML Server does not require a GPU instance. Deploy ClearML Agents on GPU-enabled instances to handle compute-intensive training tasks.
ClearML Server operates as a multi-container application that uses Elasticsearch for indexing, MongoDB for metadata storage, and Redis for caching. Traefik manages HTTPS termination and routes incoming traffic to the appropriate service.
Increase the virtual memory limit for Elasticsearch.
Apply the sysctl configuration.
Restart the Docker service to apply memory changes.
Create the directory structure for persistent storage.
data/elastic_7: Elasticsearch index storagedata/mongo_4: MongoDB database filesdata/redis: Redis cache persistencedata/fileserver: Uploaded artifacts and modelslogs: Service log filesconfig: Configuration filesSet ownership to match the container user IDs.
Create the project directory.
Navigate to the project directory.
Download the official ClearML Docker Compose file.
Open the Docker Compose file to modify port mappings and network configuration.
Locate each ports: block under the apiserver, webserver, and fileserver services and comment them out by adding # at the beginning of each line. Traefik handles external routing, so direct port exposure is not needed.
Locate the networks block at the bottom of the file and update it to use named bridge networks:
Save and close the file.
Create the environment file for ClearML service URLs. Replace clearml.example.com with your domain.
Add the following configuration:
Save and close the file.
Start the ClearML services.
Verify all containers are running.
The output displays containers for clearml-webserver, clearml-apiserver, clearml-fileserver, clearml-mongo, clearml-elastic, and clearml-redis.
Check the logs for startup errors.
For more information on managing Docker Compose stacks, see the How To Use Docker Compose article.
Traefik routes HTTPS traffic to ClearML services through subdomain-based routing, assigning each component its own subdomain with automatic certificate provisioning via Let’s Encrypt.
Create the Traefik directory.
Navigate to the Traefik directory.
Create the Let's Encrypt storage directory.
Create the certificate storage file.
Restrict the file permissions so only the owner can read and write it. Let's Encrypt requires this permission level before it writes any certificate data.
Create the Traefik environment file. Replace admin@example.com with your email address for Let's Encrypt notifications.
Add the following configuration:
Save and close the file.
Create the Traefik Docker Compose file.
Add the following configuration:
Save and close the file.
Create the Traefik dynamic configuration file. Replace clearml.example.com with your domain.
Add the following routing rules:
Save and close the file.
Start Traefik.
Verify Traefik obtained the SSL certificates.
The output indicates certificate generation for each subdomain.
The ClearML Web UI provides initial setup and ongoing configuration management through a browser-based interface.
Open a web browser and navigate to the ClearML Web UI at https://app.clearml.example.com.
Create the administrator account on first access:
admin).Navigate to Settings in the left sidebar.
Click Workspace to view the workspace configuration.
Click Create new credentials to generate API credentials.
Copy and save the credentials block. This contains the API access key and secret key required for agent and SDK configuration.
The credentials block follows this format:
ClearML Agent transforms any machine into a remote worker that retrieves tasks from queues and executes them with consistent, reproducible environments. It automatically handles virtual environments, GPU allocation, and code versioning.
You can run the ClearML Agent on the same server as the ClearML Server or on a dedicated machine. For GPU workloads, deploy agents on GPU-enabled instances.
Create the agent directory.
Navigate to the agent directory.
Install the Python virtual environment package.
Create and activate a virtual environment.
Install the ClearML Agent package.
Initialize the agent configuration.
The command starts an interactive setup. When prompted:
The agent saves the configuration to ~/clearml.conf.
Start the agent in daemon mode on the default queue.
For GPU workloads, specify GPU indices:
Verify the agent registered in the ClearML Web UI by navigating to Workers & Queues and selecting the Workers tab.
The ClearML SDK instruments Python scripts for automatic experiment tracking, logging hyperparameters, metrics, code versions, and model artifacts without code changes.
Ensure the virtual environment is active.
Install the ClearML SDK and common data science dependencies.
Configure the SDK connection to your ClearML Server.
Paste the credentials block from the ClearML Web UI when prompted. The configuration saves to ~/clearml.conf.
ClearML tracks every script execution as a task, automatically logging hyperparameters, metrics, code changes, and artifacts. The following experiment trains a Random Forest classifier to verify the server connection and demonstrate the tracking workflow.
Create a directory for experiments.
Navigate to the experiments directory.
Create the experiment script.
Add the following code:
Save and close the file.
Run the experiment.
The output displays a task URL. Open the URL to view the experiment in the ClearML Web UI.
Open the ClearML Web UI and navigate to the ClearML Tutorial project to view the experiment details.
The web interface organizes experiment data into tabs:
ClearML Pipelines chain tasks into a Directed Acyclic Graph (DAG) where step outputs feed into downstream inputs. The pipeline controller manages execution order, caching, and data flow between steps.
Navigate to the experiments directory.
Create the pipeline script.
Add the following code:
Save and close the file.
Run the pipeline.
View the pipeline execution graph in the ClearML Web UI under the ClearML Tutorial project.
Hyperparameter Optimization (HPO) automates the search for optimal model parameters by spawning experiment variations. ClearML clones a baseline experiment, modifies parameters according to defined search ranges, and tracks each trial independently.
Navigate to the experiments directory.
Create the HPO script.
Add the following code:
Save and close the file.
Run the optimization.
Monitor the optimization progress in the ClearML Web UI under ClearML Tutorial.
ClearML Serving provides model deployment with Triton inference server support. It enables production endpoints with versioning, monitoring, and automatic model updates.
Navigate to the project directory.
Clone the ClearML Serving repository.
Install the ClearML Serving package.
Create a serving service.
Copy the Serving Service ID from the output for use in subsequent steps.
Open the serving environment file.
Update the configuration with your ClearML server details. Replace the placeholders with your actual values.
Replace:
clearml.example.com with your domain.YOUR_ACCESS_KEY with your ClearML API access key.YOUR_SECRET_KEY with your ClearML API secret key.SERVING_SERVICE_ID with the ID from the previous step.Save and close the file.
Start the serving stack.
Install the PyTorch example dependencies.
Train and register a sample model.
Navigate to the task's Artifacts tab in the ClearML Web UI and copy the Model ID.
Add the model endpoint to the serving service. Replace SERVING_SERVICE_ID and MODEL_ID with your actual values.
Restart the serving containers to load the new endpoint.
Test the inference endpoint. Replace SERVER-IP with your server's IP address.
Validate the complete ClearML deployment by testing each component's functionality.
Navigate to https://app.clearml.example.com and verify you can log in and view projects.
Verify the API server responds.
Confirm the file server is accessible.
Navigate to Workers & Queues in the Web UI and confirm the agent appears under the Workers tab.
Confirm the first experiment appears in the ClearML Tutorial project with metrics, artifacts, and execution details.
Clone an experiment in the Web UI, modify a hyperparameter, and enqueue it. Verify the agent picks up and executes the task.
Migrating from Azure Machine Learning to ClearML shifts workflows from a managed cloud service to a self-hosted, infrastructure-agnostic platform.
Azure ML uses the azure.ai.ml SDK with a job-based execution model, organizing experiments, jobs, and schedules under a unified workspace.
clearml.Task.Azure ML uses command jobs via azure.ai.ml SDK to run training on managed compute clusters.
clearml.Task.task.execute_remotely() or enqueue through the Web UI. Agents running on any infrastructure pick up and execute tasks.Azure ML Pipelines use Python-based DAG definitions via the azure.ai.ml SDK.
PipelineController or the @pipeline decorator.Azure ML uses HyperDrive for automated hyperparameter optimization, integrated with command jobs.
HyperParameterOptimizer.Azure ML uses the Model Registry via azure.ai.ml SDK to version, store, and manage models.
OutputModel for automatic model tracking.Azure ML provides Real-time Endpoints for low-latency HTTPS inference and Batch Endpoints for asynchronous, large-scale inference jobs via the azure.ai.ml SDK.
Azure ML integrates with Azure Blob Storage or Azure Data Lake Storage for data access and uses Datastores and Data Assets via the azure.ai.ml SDK to manage datasets.
Azure Storage paths directly. Continue using existing containers or migrate to any object storage.azure.ai.ml SDK and azureml-* imports with the clearml package. ClearML offers a simpler, more unified API with less boilerplate.Entra ID (Managed Identities / Service Principals). ClearML uses API keys configured via clearml.conf or environment variables (CLEARML_API_ACCESS_KEY, CLEARML_API_SECRET_KEY)./mnt/azureml/ and injected AZUREML_* variables). ClearML agents work with standard Python environments and any Docker container without requiring Azure-specific directory structures or environment conventions.Azure Monitor and Application Insights) with ClearML’s built-in Scalars, Plots, and hardware monitoring dashboards.AmlCompute, ComputeInstance) at submission. ClearML uses agent queues, requiring you to deploy agents on target hardware and submit tasks to the matching queue instead of using a compute resource name.requirements.txt from the task environment; Docker base images can be set per task under the execution settings.mlflow.log_* calls route to ClearML without requiring a full SDK rewrite.You have successfully deployed ClearML Server with Traefik reverse proxy, configured agents for remote execution, and executed machine learning workflows including experiment tracking, pipelines, hyperparameter optimization, and model serving. For more information, visit the official ClearML documentation.
0 Comments
Be the first to comment and share your perspective with the community.