Update app_v3.py
Browse files
app_v3.py
CHANGED
@@ -341,9 +341,9 @@ def _(
|
|
341 |
|
342 |
s5 = mo.md(f'''
|
343 |
###**Helper Purge Functions:**
|
344 |
-
|
345 |
-
These functions help you retrieve and
|
346 |
-
|
347 |
Select the tab based on what you want to delete, then click each of the buttons one by one after the previous gives a response.
|
348 |
|
349 |
---
|
@@ -536,17 +536,6 @@ def _(deployment_client, mo, pd):
|
|
536 |
initial_selection=[0]
|
537 |
)
|
538 |
|
539 |
-
# # Display the table
|
540 |
-
# mo.md(f"""---
|
541 |
-
# <br>
|
542 |
-
# <br>
|
543 |
-
# {selection_table}
|
544 |
-
# <br>
|
545 |
-
# <br>
|
546 |
-
# ---
|
547 |
-
# <br>
|
548 |
-
# <br>
|
549 |
-
# """)
|
550 |
return (
|
551 |
framework_mapping,
|
552 |
preferred_order,
|
@@ -615,15 +604,6 @@ def _(
|
|
615 |
justify="center", gap=1, align="center", wrap=True
|
616 |
)
|
617 |
|
618 |
-
# Display the metadata inputs
|
619 |
-
# mo.vstack([
|
620 |
-
# func_metadata,
|
621 |
-
# mo.md("**Make sure to click the checkboxes before filling in descriptions and tags or they will reset.**"),
|
622 |
-
# schema_metadata
|
623 |
-
# ],
|
624 |
-
# align="center",
|
625 |
-
# gap=2
|
626 |
-
# )
|
627 |
fm = mo.vstack([
|
628 |
func_metadata,
|
629 |
],
|
@@ -974,20 +954,6 @@ def _(deployment_client, mo, pd, upload_button, uuid):
|
|
974 |
initial_selection=[0]
|
975 |
)
|
976 |
|
977 |
-
|
978 |
-
# mo.md(f"""
|
979 |
-
# <br>
|
980 |
-
# <br>
|
981 |
-
# {upload_func}
|
982 |
-
# <br>
|
983 |
-
# <br>
|
984 |
-
# ---
|
985 |
-
# {hw_selection_table}
|
986 |
-
# <br>
|
987 |
-
# <br>
|
988 |
-
|
989 |
-
|
990 |
-
# """)
|
991 |
return (
|
992 |
deployment_name,
|
993 |
deployment_type,
|
@@ -1108,14 +1074,6 @@ def _(deploy_button, deployment_definition, mo):
|
|
1108 |
deploy_button.value
|
1109 |
], justify="space-around", align="center")
|
1110 |
|
1111 |
-
# mo.md(f"""
|
1112 |
-
# {deployment_definition}
|
1113 |
-
# <br>
|
1114 |
-
# <br>
|
1115 |
-
# {deploy_fnc}
|
1116 |
-
|
1117 |
-
# ---
|
1118 |
-
# """)
|
1119 |
return (deploy_fnc,)
|
1120 |
|
1121 |
|
@@ -1125,9 +1083,8 @@ def _(deployment_client, mo):
|
|
1125 |
|
1126 |
def get_deployment_list():
|
1127 |
dep_df = deployment_client.deployments.list()
|
1128 |
-
|
1129 |
-
|
1130 |
-
return deployment_df
|
1131 |
|
1132 |
def get_deployment_ids(df):
|
1133 |
dep_list = df['ID'].tolist()
|
@@ -1137,21 +1094,19 @@ def _(deployment_client, mo):
|
|
1137 |
|
1138 |
def get_data_assets_list():
|
1139 |
data_a_df = deployment_client.data_assets.list()
|
1140 |
-
|
1141 |
-
|
1142 |
-
return data_assets_df
|
1143 |
|
1144 |
def get_data_asset_ids(df):
|
1145 |
data_asset_list = df['ASSET_ID'].tolist()
|
1146 |
return data_asset_list
|
1147 |
|
1148 |
#----
|
1149 |
-
|
1150 |
def get_repository_list():
|
1151 |
rep_list_df = deployment_client.repository.list()
|
1152 |
-
|
1153 |
-
|
1154 |
-
return repository_df
|
1155 |
|
1156 |
def get_repository_ids(df):
|
1157 |
repository_list = df['ID'].tolist()
|
@@ -1214,6 +1169,24 @@ def _(deployment_client, mo):
|
|
1214 |
get_repository_list,
|
1215 |
)
|
1216 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1217 |
|
1218 |
@app.cell
|
1219 |
def _(get_deployment_id_list, get_deployments_button, mo, purge_deployments):
|
@@ -1261,23 +1234,31 @@ def _(data_assets_purge_tab, deployments_purge_tab, mo, repository_purge_tab):
|
|
1261 |
{"Purge Deployments": deployments_purge_tab, "Purge Repository Assets": repository_purge_tab,"Purge Data Assets": data_assets_purge_tab }, lazy=False
|
1262 |
)
|
1263 |
|
1264 |
-
# asset_purge = mo.accordion(
|
1265 |
-
# {
|
1266 |
-
# """<br>
|
1267 |
-
# #### **Supporting Cleanup Functionality, lists of different assets and purge them if needed** *(purges all detected)*
|
1268 |
-
# <br>""": purge_tabs,
|
1269 |
-
# }
|
1270 |
-
# )
|
1271 |
-
|
1272 |
# asset_purge
|
1273 |
return (purge_tabs,)
|
1274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1275 |
|
1276 |
@app.cell(hide_code=True)
|
1277 |
def _(
|
|
|
1278 |
delete_data_assets,
|
1279 |
delete_deployments,
|
1280 |
delete_repository_items,
|
|
|
1281 |
get_data_asset_ids,
|
1282 |
get_data_assets_list,
|
1283 |
get_deployment_ids,
|
@@ -1285,23 +1266,28 @@ def _(
|
|
1285 |
get_repository_ids,
|
1286 |
get_repository_list,
|
1287 |
mo,
|
|
|
|
|
|
|
|
|
1288 |
):
|
1289 |
### Temporary Function Purge - Assets
|
1290 |
get_data_assets_button = mo.ui.button(
|
1291 |
label="Get Data Assets Dataframe",
|
1292 |
on_click=lambda _: get_data_assets_list(),
|
|
|
1293 |
kind="neutral",
|
1294 |
)
|
1295 |
|
1296 |
get_data_asset_id_list = mo.ui.button(
|
1297 |
label="Turn Dataframe into List of IDs",
|
1298 |
-
on_click=lambda _: get_data_asset_ids(get_data_assets_button.value
|
1299 |
kind="neutral",
|
1300 |
)
|
1301 |
|
1302 |
purge_data_assets = mo.ui.button(
|
1303 |
label="Purge Data Assets",
|
1304 |
-
on_click=lambda _: delete_data_assets(
|
1305 |
kind="danger",
|
1306 |
)
|
1307 |
|
@@ -1309,12 +1295,13 @@ def _(
|
|
1309 |
get_deployments_button = mo.ui.button(
|
1310 |
label="Get Deployments Dataframe",
|
1311 |
on_click=lambda _: get_deployment_list(),
|
|
|
1312 |
kind="neutral",
|
1313 |
)
|
1314 |
|
1315 |
get_deployment_id_list = mo.ui.button(
|
1316 |
label="Turn Dataframe into List of IDs",
|
1317 |
-
on_click=lambda _: get_deployment_ids(
|
1318 |
kind="neutral",
|
1319 |
)
|
1320 |
|
@@ -1328,12 +1315,13 @@ def _(
|
|
1328 |
get_repository_button = mo.ui.button(
|
1329 |
label="Get Repository Dataframe",
|
1330 |
on_click=lambda _: get_repository_list(),
|
|
|
1331 |
kind="neutral",
|
1332 |
)
|
1333 |
|
1334 |
get_repository_id_list = mo.ui.button(
|
1335 |
label="Turn Dataframe into List of IDs",
|
1336 |
-
on_click=lambda _: get_repository_ids(
|
1337 |
kind="neutral",
|
1338 |
)
|
1339 |
|
|
|
341 |
|
342 |
s5 = mo.md(f'''
|
343 |
###**Helper Purge Functions:**
|
344 |
+
|
345 |
+
These functions help you retrieve, select and delete deployments, data assets or repository assets (functions, models, etc.) that you have in the deployment space. This is meant to support fast cleanup.
|
346 |
+
|
347 |
Select the tab based on what you want to delete, then click each of the buttons one by one after the previous gives a response.
|
348 |
|
349 |
---
|
|
|
536 |
initial_selection=[0]
|
537 |
)
|
538 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
539 |
return (
|
540 |
framework_mapping,
|
541 |
preferred_order,
|
|
|
604 |
justify="center", gap=1, align="center", wrap=True
|
605 |
)
|
606 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
607 |
fm = mo.vstack([
|
608 |
func_metadata,
|
609 |
],
|
|
|
954 |
initial_selection=[0]
|
955 |
)
|
956 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
957 |
return (
|
958 |
deployment_name,
|
959 |
deployment_type,
|
|
|
1074 |
deploy_button.value
|
1075 |
], justify="space-around", align="center")
|
1076 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1077 |
return (deploy_fnc,)
|
1078 |
|
1079 |
|
|
|
1083 |
|
1084 |
def get_deployment_list():
|
1085 |
dep_df = deployment_client.deployments.list()
|
1086 |
+
dep_df = pd.DataFrame(dep_df)
|
1087 |
+
return dep_df
|
|
|
1088 |
|
1089 |
def get_deployment_ids(df):
|
1090 |
dep_list = df['ID'].tolist()
|
|
|
1094 |
|
1095 |
def get_data_assets_list():
|
1096 |
data_a_df = deployment_client.data_assets.list()
|
1097 |
+
data_a_df = pd.DataFrame(data_a_df)
|
1098 |
+
return data_a_df
|
|
|
1099 |
|
1100 |
def get_data_asset_ids(df):
|
1101 |
data_asset_list = df['ASSET_ID'].tolist()
|
1102 |
return data_asset_list
|
1103 |
|
1104 |
#----
|
1105 |
+
|
1106 |
def get_repository_list():
|
1107 |
rep_list_df = deployment_client.repository.list()
|
1108 |
+
rep_list_df = pd.DataFrame(rep_list_df)
|
1109 |
+
return rep_list_df
|
|
|
1110 |
|
1111 |
def get_repository_ids(df):
|
1112 |
repository_list = df['ID'].tolist()
|
|
|
1169 |
get_repository_list,
|
1170 |
)
|
1171 |
|
1172 |
+
@app.cell
|
1173 |
+
def _(get_data_assets_tab, get_deployments_tab, get_repository_tab, mo):
|
1174 |
+
if get_deployments_tab() is not None:
|
1175 |
+
deployments_table = mo.ui.table(get_deployments_tab())
|
1176 |
+
else:
|
1177 |
+
deployments_table = mo.md("No Table Loaded")
|
1178 |
+
|
1179 |
+
if get_repository_tab() is not None:
|
1180 |
+
repository_table = mo.ui.table(get_repository_tab())
|
1181 |
+
else:
|
1182 |
+
repository_table = mo.md("No Table Loaded")
|
1183 |
+
|
1184 |
+
if get_data_assets_tab() is not None:
|
1185 |
+
data_assets_table = mo.ui.table(get_data_assets_tab())
|
1186 |
+
else:
|
1187 |
+
data_assets_table = mo.md("No Table Loaded")
|
1188 |
+
|
1189 |
+
return data_assets_table, deployments_table, repository_table
|
1190 |
|
1191 |
@app.cell
|
1192 |
def _(get_deployment_id_list, get_deployments_button, mo, purge_deployments):
|
|
|
1234 |
{"Purge Deployments": deployments_purge_tab, "Purge Repository Assets": repository_purge_tab,"Purge Data Assets": data_assets_purge_tab }, lazy=False
|
1235 |
)
|
1236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1237 |
# asset_purge
|
1238 |
return (purge_tabs,)
|
1239 |
|
1240 |
+
@app.cell
|
1241 |
+
def _(mo):
|
1242 |
+
get_deployments_tab, set_deployments_tab = mo.state(None)
|
1243 |
+
get_repository_tab, set_repository_tab = mo.state(None)
|
1244 |
+
get_data_assets_tab, set_data_assets_tab = mo.state(None)
|
1245 |
+
return (
|
1246 |
+
get_data_assets_tab,
|
1247 |
+
get_deployments_tab,
|
1248 |
+
get_repository_tab,
|
1249 |
+
set_data_assets_tab,
|
1250 |
+
set_deployments_tab,
|
1251 |
+
set_repository_tab,
|
1252 |
+
)
|
1253 |
+
|
1254 |
|
1255 |
@app.cell(hide_code=True)
|
1256 |
def _(
|
1257 |
+
data_assets_table,
|
1258 |
delete_data_assets,
|
1259 |
delete_deployments,
|
1260 |
delete_repository_items,
|
1261 |
+
deployments_table,
|
1262 |
get_data_asset_ids,
|
1263 |
get_data_assets_list,
|
1264 |
get_deployment_ids,
|
|
|
1266 |
get_repository_ids,
|
1267 |
get_repository_list,
|
1268 |
mo,
|
1269 |
+
repository_table,
|
1270 |
+
set_data_assets_tab,
|
1271 |
+
set_deployments_tab,
|
1272 |
+
set_repository_tab,
|
1273 |
):
|
1274 |
### Temporary Function Purge - Assets
|
1275 |
get_data_assets_button = mo.ui.button(
|
1276 |
label="Get Data Assets Dataframe",
|
1277 |
on_click=lambda _: get_data_assets_list(),
|
1278 |
+
on_change=lambda value: set_data_assets_tab(value),
|
1279 |
kind="neutral",
|
1280 |
)
|
1281 |
|
1282 |
get_data_asset_id_list = mo.ui.button(
|
1283 |
label="Turn Dataframe into List of IDs",
|
1284 |
+
on_click=lambda _: get_data_asset_ids(get_data_assets_button.value),
|
1285 |
kind="neutral",
|
1286 |
)
|
1287 |
|
1288 |
purge_data_assets = mo.ui.button(
|
1289 |
label="Purge Data Assets",
|
1290 |
+
on_click=lambda _: delete_data_assets(data_assets_table.value),
|
1291 |
kind="danger",
|
1292 |
)
|
1293 |
|
|
|
1295 |
get_deployments_button = mo.ui.button(
|
1296 |
label="Get Deployments Dataframe",
|
1297 |
on_click=lambda _: get_deployment_list(),
|
1298 |
+
on_change=lambda value: set_deployments_tab(value),
|
1299 |
kind="neutral",
|
1300 |
)
|
1301 |
|
1302 |
get_deployment_id_list = mo.ui.button(
|
1303 |
label="Turn Dataframe into List of IDs",
|
1304 |
+
on_click=lambda _: get_deployment_ids(deployments_table.value),
|
1305 |
kind="neutral",
|
1306 |
)
|
1307 |
|
|
|
1315 |
get_repository_button = mo.ui.button(
|
1316 |
label="Get Repository Dataframe",
|
1317 |
on_click=lambda _: get_repository_list(),
|
1318 |
+
on_change=lambda value: set_repository_tab(value),
|
1319 |
kind="neutral",
|
1320 |
)
|
1321 |
|
1322 |
get_repository_id_list = mo.ui.button(
|
1323 |
label="Turn Dataframe into List of IDs",
|
1324 |
+
on_click=lambda _: get_repository_ids(repository_table.value),
|
1325 |
kind="neutral",
|
1326 |
)
|
1327 |
|