Files
mlflow-docker-minio/quickstart/mlflow_tracking.py

23 lines
645 B
Python
Raw Normal View History

2018-11-22 21:14:20 +08:00
import os
from random import random, randint
2020-08-23 14:48:38 +02:00
from mlflow import mlflow,log_metric, log_param, log_artifacts
2018-11-22 21:14:20 +08:00
if __name__ == "__main__":
2020-08-23 14:48:38 +02:00
with mlflow.start_run() as run:
mlflow.set_tracking_uri('https://mlflow.localhost')
2020-08-23 14:48:38 +02:00
print("Running mlflow_tracking.py")
2018-11-22 21:14:20 +08:00
2020-08-23 14:48:38 +02:00
log_param("param1", randint(0, 100))
log_metric("foo", random())
log_metric("foo", random() + 1)
log_metric("foo", random() + 2)
2018-11-22 21:14:20 +08:00
2020-08-23 14:48:38 +02:00
if not os.path.exists("outputs"):
os.makedirs("outputs")
with open("outputs/test.txt", "w") as f:
f.write("hello world!")
2018-11-22 21:14:20 +08:00
2020-08-23 14:48:38 +02:00
log_artifacts("outputs")