forked from mlflow/mlflow-export-import
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImport_Experiment.py
68 lines (44 loc) · 1.76 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Databricks notebook source
# MAGIC %md ### Import Experiment
# MAGIC
# MAGIC **Widgets**
# MAGIC * `1. Input directory` - Input directory containing an exported experiment.
# MAGIC * `2. Destination experiment name` - will create experiment if it doesn't exist.
# MAGIC * `3. Import permissions`
# MAGIC * `4. Import source tags`
# COMMAND ----------
# MAGIC %md ### Include setup
# COMMAND ----------
# MAGIC %run ./Common
# COMMAND ----------
# MAGIC %md ### Widget setup
# 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")
dbutils.widgets.dropdown("3. Import permissions","no",["yes","no"])
import_permissions = dbutils.widgets.get("3. Import permissions") == "yes"
dbutils.widgets.dropdown("4. Import source tags","no",["yes","no"])
import_source_tags = dbutils.widgets.get("4. Import source tags") == "yes"
print("input_dir:", input_dir)
print("experiment_name:", experiment_name)
print("import_permissions:", import_permissions)
print("import_source_tags:", import_source_tags)
# COMMAND ----------
assert_widget(experiment_name, "1. Destination experiment name")
assert_widget(input_dir, "2. Input directory")
# COMMAND ----------
# MAGIC %md ### Import experiment
# COMMAND ----------
from mlflow_export_import.experiment.import_experiment import import_experiment
import_experiment(
experiment_name = experiment_name,
input_dir = input_dir,
import_permissions = import_permissions,
import_source_tags = import_source_tags
)
# COMMAND ----------
# MAGIC %md ### Display experiment UI link
# COMMAND ----------
display_experiment_info(experiment_name)