Skip to content

Commit

Permalink
delete registry after creation (Azure#2107)
Browse files Browse the repository at this point in the history
* delete registry after creation

* always run deletion

* init env

* set working dir

* add sdk_helper

* add sub_id

* edit for debugging

* try debugging

* try deletion inside the notebook

* delete in the same step

* print registry name for debugging

* remove deletion for testing.

* change everything back for final pr

* modify format

* make deletion inside the ipnb

* try sdk deletion

* try sdk

* use verified api.

* change format

* Update registry-create.ipynb
  • Loading branch information
quchuyuan committed Mar 20, 2023
1 parent a8ceaef commit 98774b8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions infra/sdk_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@ function replace_template_values() {
-e "s/<REGISTRY_NAME>/$(echo "$REGISTRY_NAME")/g" \
-e "s/<CLUSTER_NAME>/$(echo "$ARC_CLUSTER_NAME")/g" \
-e "s/<COMPUTE_NAME>/$(echo "$ARC_COMPUTE_NAME")/g" \
-e "s/<TIME_STAMP>/$(echo "$timestamp")/g" \
-e "s/DefaultAzureCredential/AzureCliCredential/g" \
-e "s/InteractiveBrowserCredential/AzureCliCredential/g" \
-e "s/@pipeline(/&force_rerun=True,/g" \
Expand Down
29 changes: 25 additions & 4 deletions sdk/python/resources/registry/registry-create.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@
" credential=credential,\n",
" subscription_id=\"<SUBSCRIPTION_ID>\",\n",
" resource_group_name=\"<RESOURCE_GROUP>\",\n",
")"
")\n",
"\n",
"subscription_id = (\"<SUBSCRIPTION_ID>\",)\n",
"resource_group_name = \"<RESOURCE_GROUP>\""
]
},
{
Expand Down Expand Up @@ -145,7 +148,9 @@
"print(registry)\n",
"\n",
"# You can override the registry name if needed\n",
"registry.name = \"DemoRegistryPython\"\n",
"ts = \"<TIME_STAMP>\"\n",
"registry.name = \"DemoRegistryPython\" + \"-\" + ts\n",
"print(f\"the registry name: {registry.name}\")\n",
"\n",
"registry = ml_client.registries.begin_create(registry=registry).result(\n",
" timeout=LROConfigurations.POLLING_TIMEOUT\n",
Expand Down Expand Up @@ -180,11 +185,12 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "5468f90b",
"metadata": {},
"source": [
"### 2.1 List Registries\n",
"### 2.2 List Registries\n",
"\n",
"This will list all registries that exist under the resource group of your `MLClient`. "
]
Expand All @@ -200,13 +206,28 @@
" print(reg.name)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "011f0562",
"metadata": {},
"source": [
"### 2.3 Delete Registry\n",
"\n",
"This will delete the previously created registry."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5f2c0f69",
"metadata": {},
"outputs": [],
"source": []
"source": [
"ml_client.registries.begin_delete(name=registry.name).result(\n",
" timeout=LROConfigurations.POLLING_TIMEOUT\n",
")"
]
}
],
"metadata": {
Expand Down

0 comments on commit 98774b8

Please sign in to comment.