File size: 578 Bytes
a9b4192
 
b3090f2
a9b4192
 
 
 
b3090f2
a9b4192
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import subprocess

if __name__ == "__main__":
    # Ensure the /data directory exists
    os.makedirs("/data/mlruns", exist_ok=True)
    os.makedirs("/data", exist_ok=True)

    # Optional: Set permissions (be cautious with permissions in production)
    os.chmod("/data", 0o777)
    os.chmod("/data/mlruns", 0o777)

    # Start the MLflow server
    subprocess.run([
        "mlflow", "server",
        "--backend-store-uri", "sqlite:////data/mlflow.db",
        "--default-artifact-root", "/data/mlruns",
        "--host", "0.0.0.0",
        "--port", "7860"
    ])