Skip to content

Commit 5715b55

Browse files
authored
Merge pull request #3244 from pareenaverma/content_review
MLFlow on Axion Tech review
2 parents e8ab5a0 + 3d059d2 commit 5715b55

6 files changed

Lines changed: 129 additions & 108 deletions

File tree

content/learning-paths/servers-and-cloud-computing/mlflow-axion/_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ draft: true
55
cascade:
66
draft: true
77

8+
description: Install MLflow on a Google Cloud C4A Axion Arm VM running SUSE Linux, track experiments with MLflow Tracking, version models using the Model Registry, and deploy a model as a REST API.
9+
810
minutes_to_complete: 30
911

1012
who_is_this_for: This is an introductory topic for DevOps engineers, ML engineers, and software developers who want to manage the machine learning lifecycle using MLflow on SUSE Linux Enterprise Server (SLES) Arm64, track experiments, version models, and deploy models as scalable APIs.

content/learning-paths/servers-and-cloud-computing/mlflow-axion/background.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ To learn more, visit the [MLflow documentation](https://mlflow.org/docs/latest/i
3434

3535
In this section, you:
3636

37-
* Explored Google Axion C4A Arm-based VMs and their performance advantages for ML workflows
38-
* Reviewed MLflow components, including Tracking, Projects, Models, and Model Registry
39-
* Understood how Arm architecture improves efficiency and scalability for ML lifecycle management
37+
* Explored Google Axion C4A Arm-based VMs and their performance advantages for ML workflows
38+
* Reviewed MLflow components, including Tracking, Projects, Models, and Model Registry
39+
* Explored how Arm architecture improves efficiency and scalability for ML lifecycle management
4040

4141
Next, you'll create a firewall rule to enable remote access to the MLflow UI and model serving APIs used in this Learning Path.

content/learning-paths/servers-and-cloud-computing/mlflow-axion/firewall.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ For help with GCP setup, see the Learning Path [Getting started with Google Clou
1616

1717
Navigate to the [Google Cloud Console](https://console.cloud.google.com/), go to **VPC Network > Firewall**, and select **Create firewall rule**.
1818

19-
![Google Cloud Console VPC Network Firewall page showing the Create firewall rule button in the top menu bar alt-txt#center](images/firewall-rule.png "Create a firewall rule in Google Cloud Console")
19+
![Google Cloud Console VPC Network Firewall page showing the Create firewall rule button in the top menu bar#center](images/firewall-rule.png "Create a firewall rule in Google Cloud Console")
2020

21-
Next, create the firewall rule that exposes required ports for Ray.
21+
Next, create the firewall rule that exposes the ports required for MLflow.
2222

2323
Set the **Name** of the new rule to "allow-mlflow-ports". Select the network that you intend to bind to your VM.
2424

25-
Set **Direction of traffic** to "Ingress". Set **Allow on match** to "Allow" and **Targets** to "Specified target tags". Enter "allow-ray-ports" in the **Target tags** text field. Set **Source IPv4 ranges** to "0.0.0.0/0".
25+
Set **Direction of traffic** to "Ingress". Set **Allow on match** to "Allow" and **Targets** to "All instances in the network". Set **Source IPv4 ranges** to "0.0.0.0/0".
2626

27-
![Google Cloud Console Create firewall rule form with Name set to allow-mlflow-ports and Direction of traffic set to Ingress alt-txt#center](images/network-rule.png "Configuring the allow-ray-ports firewall rule")
27+
![Google Cloud Console Create firewall rule form with Name set to allow-mlflow-ports and Direction of traffic set to Ingress#center](images/network-rule.png "Configuring the allow-mlflow-ports firewall rule")
2828

2929
Finally, select **Specified protocols and ports** under the **Protocols and ports** section. Select the **TCP** checkbox and enter:
3030

@@ -37,7 +37,7 @@ Finally, select **Specified protocols and ports** under the **Protocols and port
3737

3838
Then select **Create**.
3939

40-
![Google Cloud Console Protocols and ports section with TCP ports configured alt-txt#center](images/network-port.png "Setting Mlflow ports in the firewall rule")
40+
![Google Cloud Console Protocols and ports section with TCP selected and ports 5000 and 6000 entered#center](images/network-port.png "Setting MLflow ports in the firewall rule")
4141

4242
## What you've accomplished and what's next
4343

@@ -46,4 +46,4 @@ In this section, you:
4646
* Created a firewall rule to expose MLflow UI and model serving API
4747
* Enabled external access to monitor experiments and access deployed models
4848

49-
Next, you'll run MLflow workloads and serve models on your Arm-based virtual machine.
49+
Next, you'll create a C4A Arm VM and attach it to this firewall rule.

content/learning-paths/servers-and-cloud-computing/mlflow-axion/instance.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Create a Google Axion C4A Arm virtual machine on GCP
2+
title: Create a Google Axion C4A Arm virtual machine on GCP
33
weight: 4
44

55
### FIXED, DO NOT MODIFY
@@ -8,7 +8,7 @@ layout: learningpathall
88

99
## Provision a Google Axion C4A Arm VM
1010

11-
In this section, you'll create a Google Axion C4A Arm-based virtual machine on Google Cloud Platform. You'll use the `c4a-standard-4` machine type, which provides 4 vCPUs and 16 GB of memory. This VM will host your Ray application.
11+
In this section, you'll create a Google Axion C4A Arm-based virtual machine on Google Cloud Platform. You'll use the `c4a-standard-4` machine type, which provides 4 vCPUs and 16 GB of memory. This VM will host your MLflow tracking server and model serving API.
1212

1313
{{% notice Note %}}
1414
For help with GCP setup, see the Learning Path [Getting started with Google Cloud Platform](/learning-paths/servers-and-cloud-computing/csp/google/).
@@ -32,11 +32,14 @@ To create a virtual machine based on the C4A instance type:
3232
- For the license type, choose **Pay as you go**.
3333
- Increase **Size (GB)** from **10** to **100** to allocate sufficient disk space.
3434
- Select **Choose** to apply the changes.
35+
- Expand **Advanced options** and select **Networking**.
36+
- Under **Network tags**, enter `allow-mlflow-ports`.
37+
- This links the VM to the firewall rule you created in the previous step, ensuring inbound access to ports 5000 (MLflow UI) and 6000 (model serving API).
3538
- Select **Create** to launch the virtual machine.
3639

3740
After the instance starts, select **SSH** next to the VM in the instance list to open a browser-based terminal session.
3841

39-
![Google Cloud Console VM instances page displaying running instance with green checkmark and SSH button in the Connect column alt-txt#center](images/gcp-pubip-ssh.png "Connecting to a running C4A VM using SSH")
42+
![Google Cloud Console VM instances page displaying running instance with green checkmark and SSH button in the Connect column#center](images/gcp-pubip-ssh.png "Connecting to a running C4A VM using SSH")
4043

4144
A new browser window opens with a terminal connected to your VM.
4245

content/learning-paths/servers-and-cloud-computing/mlflow-axion/model-registry_deployment.md

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ layout: learningpathall
1111
This section covers model versioning, alias assignment, and serving the model as an API.
1212

1313

14-
## Terminal usage (Important)
14+
## Terminal usage
1515

16-
We continue using the same terminals:
16+
This section continues with the same two terminals from the previous step:
1717

18-
- **Terminal A** → Run scripts and test API
19-
- **Terminal B** → MLflow server (already running)
20-
- **Optional Terminal C** → Model serving (if you want a separate terminal)
21-
22-
If you want simplicity, you can use only **Terminal A + B**
18+
- **Terminal A** → Run scripts, start model serving, and test the API
19+
- **Terminal B** → MLflow tracking server (keep this running)
2320

2421
## Set tracking URI
2522

@@ -29,8 +26,7 @@ In **Terminal A**, run:
2926
export MLFLOW_TRACKING_URI=http://127.0.0.1:5000
3027
```
3128

32-
- This tells MLflow to use your running server.
33-
- Without this, MLflow will not find your models.
29+
This tells the MLflow client which tracking server to connect to. Without it, the client defaults to a local directory and won't find the models registered on your server.
3430

3531
## Create alias script
3632

@@ -67,54 +63,64 @@ EOF
6763

6864
## Assign production model
6965

70-
**Run the script:**
66+
Run the script:
7167

7268
```bash
7369
python set_prod.py
7470
```
71+
The output is similar to:
7572

73+
```output
74+
Production version: 1
75+
```
7676
**What this does:**
7777

78-
- checks all model versions.
79-
- finds the best accuracy.
80-
- marks it as production.
78+
This script queries all registered versions of `iris-model`, finds the version with the highest `accuracy` metric, and assigns it the `production` alias. The alias is how `mlflow models serve` identifies which model version to load.
8179

8280
## Serve model
8381

84-
Now we deploy the model as an API.
82+
With Terminal B still running the MLflow tracking server, use Terminal A to start the model serving API. `mlflow models serve` loads the aliased model from the registry and starts a uvicorn HTTP server that exposes a `/invocations` endpoint for inference.
8583

86-
You can run this in **Terminal A** or open **Terminal C**.
84+
In **Terminal A**, navigate to the project directory and set the tracking URI:
8785

8886
```bash
8987
cd ~/mlflow-learning-path
90-
source mlflow-env/bin/activate
91-
```
92-
93-
```bash
9488
export MLFLOW_TRACKING_URI=http://127.0.0.1:5000
9589
```
9690

91+
Start the model server in the background using `&` so Terminal A stays free for testing:
92+
9793
```bash
9894
mlflow models serve \
9995
-m "models:/iris-model@production" \
10096
-p 6000 \
101-
--no-conda
97+
--no-conda &
10298
```
10399

104-
## View registered models
100+
- `-m "models:/iris-model@production"` — loads the model version with the `production` alias from the registry
101+
- `-p 6000` — serves on port 6000
102+
- `--no-conda` — uses the active virtual environment instead of creating a new conda environment
103+
104+
The output is similar to:
105105

106-
Go to:
106+
```output
107+
2026/05/04 13:42:12 INFO mlflow.models.flavor_backend_registry: Selected backend for flavor 'python_function'
108+
2026/05/04 13:42:12 INFO mlflow.pyfunc.backend: === Running command 'exec uvicorn --host 127.0.0.1 --port 6000 --workers 1 mlflow.pyfunc.scoring_server.app:app'
109+
INFO: Started server process [4527]
110+
INFO: Waiting for application startup.
111+
INFO: Application startup complete.
112+
INFO: Uvicorn running on http://127.0.0.1:6000 (Press CTRL+C to quit)
113+
```
114+
## View registered models
107115

108-
- Model training → Models
116+
In the MLflow UI at `http://<VM-IP>:5000`, select the **Models** tab. You should see the `iris-model` entry with multiple registered versions and the `production` alias assigned to the best-performing one.
109117

110-
![MLflow Model Registry showing model versions#center](images/mlflow-model.png "MLflow Model Registry with versions")
111118

112-
You should see:
119+
![MLflow Model Registry showing iris-model with multiple registered versions and the production alias assigned to the best run#center](images/mlflow-model.png "MLflow Model Registry with versions")
113120

114-
- multiple versions (v1, v2, v3…)
115-
- one marked as production
121+
## Test the API from Terminal A
116122

117-
## Test inference from the Free Terminal ( A or C)
123+
The `/invocations` endpoint accepts data in the `dataframe_records` format — a list of JSON objects where each object represents one row, with column names as keys. The model returns a prediction for each row. Send a single Iris flower measurement to test inference:
118124

119125
```bash
120126
curl -X POST http://127.0.0.1:6000/invocations \
@@ -128,14 +134,18 @@ curl -X POST http://127.0.0.1:6000/invocations \
128134
"petal width (cm)": 0.2
129135
}
130136
]
137+
}'
131138
```
132139

133-
You will get a prediction output like:
140+
The expected output is:
134141

135142
```output
136-
[0]
143+
INFO: 127.0.0.1:41158 - "POST /invocations HTTP/1.1" 200 OK
144+
{"predictions": [0]}
137145
```
138146

147+
The prediction `0` corresponds to Iris setosa, which is the correct class for these measurements. The Iris dataset has three classes: `0` = setosa, `1` = versicolor, `2` = virginica.
148+
139149
## What you've learned
140150

141151
You have successfully:
@@ -144,3 +154,12 @@ You have successfully:
144154
- Assigned a production alias
145155
- Deployed the model as an API
146156
- Performed inference using curl
157+
158+
## Summary
159+
160+
You have completed the full MLflow lifecycle on a Google Cloud C4A Axion Arm VM running SUSE Linux.
161+
162+
Starting from a freshly provisioned Arm-based VM, you installed MLflow and its dependencies in an isolated Python virtual environment, then started the MLflow tracking server backed by a local SQLite database. You trained a logistic regression model on the Iris dataset across three hyperparameter configurations, with each run automatically logged to the MLflow Tracking UI and each model version registered in the Model Registry.
163+
164+
In this final section, you used the Model Registry to select the best-performing version by accuracy, assigned it a `production` alias, and served it as a REST API using `mlflow models serve`. You then validated the end-to-end workflow by sending a live inference request using curl and interpreting the prediction.
165+

0 commit comments

Comments
 (0)