-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathCopy_Run.py
62 lines (42 loc) · 1.62 KB
/
Copy_Run.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
# Databricks notebook source
# MAGIC %md ## Copy Run
# MAGIC
# MAGIC ##### Overview
# MAGIC
# MAGIC Copy an MLflow run to either the current or to another workspace.
# MAGIC
# MAGIC ##### Widgets
# MAGIC
# MAGIC * `1. Source run ID` - Source run ID.
# MAGIC * `2. Destination experiment name` - Destination experiment name of the run.
# MAGIC * `3. Destination workspace` - Destination workspace - default is current workspace.
# COMMAND ----------
# MAGIC %md #### Setup
# COMMAND ----------
# MAGIC %run ./Common
# COMMAND ----------
dbutils.widgets.text("1. Source run ID", "")
src_run_id = dbutils.widgets.get("1. Source run ID")
dbutils.widgets.text("2. Destination experiment", "")
dst_experiment_name = dbutils.widgets.get("2. Destination experiment")
dbutils.widgets.text("3. Destination workspace", "databricks")
dst_run_workspace = dbutils.widgets.get("3. Destination workspace")
dst_run_workspace = dst_run_workspace or "databricks"
print("src_run_id:", src_run_id)
print("dst_experiment_name:", dst_experiment_name)
print("dst_run_workspace:", dst_run_workspace)
# COMMAND ----------
assert_widget(src_run_id, "1. Source run ID")
assert_widget(dst_experiment_name, "2. Destination experiment name")
# COMMAND ----------
# MAGIC %md #### Copy Run
# COMMAND ----------
from mlflow_export_import.copy.copy_run import copy
dst_run = copy(src_run_id, dst_experiment_name, "databricks", dst_run_workspace)
# COMMAND ----------
dst_run
# COMMAND ----------
if dst_run_workspace == "databricks":
display_run_uri(dst_run.info.run_id)
else:
print(f"Cannot display run '{dst_run.info.run_id}' since it is in a remove workspace.")