-
Notifications
You must be signed in to change notification settings - Fork 1
/
00_Reset.py
44 lines (28 loc) · 1.31 KB
/
00_Reset.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
# Databricks notebook source
from mlflow.tracking import MlflowClient
client = MlflowClient()
# COMMAND ----------
path = "/Users/[email protected]/customers/discovery/datasci-overview/02_Introduction-to-tracking"
model_name = "random-forest-model"
# COMMAND ----------
for mv in client.search_model_versions(f"name='{model_name}'"):
client.transition_model_version_stage(name=mv.name, version=mv.version, stage="None")
client.delete_model_version(name=mv.name, version=mv.version)
# COMMAND ----------
experimentID = [e.experiment_id for e in client.list_experiments() if e.name==path][0]
runs = spark.read.format("mlflow-experiment").load(experimentID)
# COMMAND ----------
for run in runs.collect():
client.delete_run(run.run_id)
# COMMAND ----------
# MAGIC %sql
# MAGIC drop table if exists covid.timeseries;
# MAGIC drop table if exists lending_club.cleaned;
# MAGIC drop table if exists lending_club.model_test;
# COMMAND ----------
dbutils.fs.rm("/home/stuart/datasets/lending_club/cleaned", True)
dbutils.fs.rm("/home/stuart/datasets/lending_club/model_test", True)
# COMMAND ----------
# dbutils.fs.rm("abfss://[email protected]/lending_club/cleaned", True)
# dbutils.fs.rm("abfss://[email protected]/lending_club/model_test", True)
# COMMAND ----------