aipackage/ansible/roles/mlflow/tasks/main.yml

58 lines
1.4 KiB
YAML

---
# MLflow — experiment tracking and model registry
- name: Install MLflow in cezen conda env
become_user: cezen
shell: |
/opt/cezen/miniconda/bin/conda run -n cezen pip install mlflow boto3
retries: 3
delay: 10
- name: Create MLflow directories
file:
path: "{{ item }}"
state: directory
owner: cezen
group: cezen
loop:
- /opt/cezen/data/mlflow
- /opt/cezen/data/mlflow/artifacts
- name: Create MLflow systemd service
copy:
dest: /etc/systemd/system/mlflow.service
content: |
[Unit]
Description=MLflow Tracking Server
After=network.target minio.service
[Service]
Type=simple
User=cezen
Group=cezen
ExecStart=/opt/cezen/miniconda/envs/cezen/bin/mlflow server \
--host 0.0.0.0 \
--port 5000 \
--backend-store-uri sqlite:///opt/cezen/data/mlflow/mlflow.db \
--default-artifact-root /opt/cezen/data/mlflow/artifacts
Restart=always
RestartSec=5
Environment="PATH=/opt/cezen/miniconda/envs/cezen/bin:/usr/local/bin:/usr/bin:/bin"
[Install]
WantedBy=multi-user.target
mode: "0644"
- name: Enable and start MLflow
systemd:
name: mlflow
enabled: yes
state: started
daemon_reload: yes
- name: Wait for MLflow to be ready
wait_for:
host: localhost
port: 5000
timeout: 120
ignore_errors: true