forked from mlflow/mlflow-export-import
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Import_Experiment.py
40 lines (27 loc) · 1.1 KB
/
Import_Experiment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Databricks notebook source
# MAGIC %md ### Import Experiment
# MAGIC
# MAGIC **Widgets**
# MAGIC * Input directory - DBFS input directory containing an exported experiment.
# MAGIC * Destination experiment name - Will create if it doesn't exist.
# MAGIC
# MAGIC #### Setup
# MAGIC * See the Setup section in [README]($./_README).
# COMMAND ----------
# MAGIC %run ./Common
# COMMAND ----------
dbutils.widgets.text("1. Destination experiment name", "")
experiment_name = dbutils.widgets.get("1. Destination experiment name")
dbutils.widgets.text("2. Input directory", "")
input_dir = dbutils.widgets.get("2. Input directory")
print("input_dir:",input_dir)
print("experiment_name:",experiment_name)
# COMMAND ----------
assert_widget(experiment_name, "1. Destination experiment name")
assert_widget(input_dir, "2. Input directory")
# COMMAND ----------
from mlflow_export_import.experiment.import_experiment import ExperimentImporter
importer = ExperimentImporter(mlflow.client.MlflowClient())
importer.import_experiment(experiment_name, input_dir)
# COMMAND ----------
display_experiment_uri(experiment_name)