Skip to content

Commit

Permalink
Reordered removing monitoring schedules
Browse files Browse the repository at this point in the history
  • Loading branch information
svpino committed Mar 31, 2024
1 parent 942f3f2 commit 10e8bf8
Showing 1 changed file with 78 additions and 125 deletions.
203 changes: 78 additions & 125 deletions program/cohort.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7782,31 +7782,14 @@
},
{
"cell_type": "code",
"execution_count": 344,
"execution_count": 144,
"id": "4966c9c2",
"metadata": {
"tags": [
"hide-output"
]
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:sagemaker:Creating model with name: pipeline-penguins-2024-03-30-17-25-24-537\n",
"INFO:sagemaker:Creating endpoint-config with name penguins-endpoint\n",
"INFO:sagemaker:Creating endpoint with name penguins-endpoint\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"-------!"
]
}
],
"outputs": [],
"source": [
"%%script false --no-raise-error\n",
"#| eval: false\n",
Expand Down Expand Up @@ -8309,6 +8292,29 @@
"check_execution(data_monitor)"
]
},
{
"cell_type": "markdown",
"id": "46e9faf0",
"metadata": {},
"source": [
"### Step 7 - Deleting Monitoring Schedule\n",
"\n",
"Once we are done with it, we can delete the Data Monitoring schedule.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7ff8bfc3",
"metadata": {},
"outputs": [],
"source": [
"try:\n",
" data_monitor.delete_monitoring_schedule()\n",
"except Exception as e:\n",
" print(e)"
]
},
{
"cell_type": "markdown",
"id": "a4ec9a8b",
Expand Down Expand Up @@ -8796,6 +8802,29 @@
"check_execution(model_monitor)"
]
},
{
"cell_type": "markdown",
"id": "8d403f00",
"metadata": {},
"source": [
"### Step 7 - Deleting Monitoring Schedule\n",
"\n",
"Once we are done with it, we can delete the Data Monitoring schedule.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7f250115",
"metadata": {},
"outputs": [],
"source": [
"try:\n",
" model_monitor.delete_monitoring_schedule()\n",
"except Exception as e:\n",
" print(e)"
]
},
{
"cell_type": "markdown",
"id": "ae348ea3",
Expand All @@ -8820,7 +8849,7 @@
},
{
"cell_type": "code",
"execution_count": 393,
"execution_count": 145,
"id": "d322d415",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -8866,7 +8895,7 @@
},
{
"cell_type": "code",
"execution_count": 137,
"execution_count": 146,
"id": "6c8aea09",
"metadata": {},
"outputs": [],
Expand All @@ -8891,7 +8920,7 @@
},
{
"cell_type": "code",
"execution_count": 399,
"execution_count": 147,
"id": "dd20b354",
"metadata": {
"tags": [
Expand All @@ -8902,17 +8931,17 @@
{
"data": {
"text/plain": [
"{'ModelArn': 'arn:aws:sagemaker:us-east-1:325223348818:model/shadow-penguins-endpoint-production-0330155951',\n",
" 'ResponseMetadata': {'RequestId': '9b117d81-8cb6-4477-bc8b-ed43dc3089ff',\n",
"{'ModelArn': 'arn:aws:sagemaker:us-east-1:325223348818:model/shadow-penguins-endpoint-production-0331125310',\n",
" 'ResponseMetadata': {'RequestId': '15e570ab-106c-4b58-b536-1146770164d7',\n",
" 'HTTPStatusCode': 200,\n",
" 'HTTPHeaders': {'x-amzn-requestid': '9b117d81-8cb6-4477-bc8b-ed43dc3089ff',\n",
" 'HTTPHeaders': {'x-amzn-requestid': '15e570ab-106c-4b58-b536-1146770164d7',\n",
" 'content-type': 'application/x-amz-json-1.1',\n",
" 'content-length': '108',\n",
" 'date': 'Sat, 30 Mar 2024 19:59:52 GMT'},\n",
" 'date': 'Sun, 31 Mar 2024 16:53:12 GMT'},\n",
" 'RetryAttempts': 0}}"
]
},
"execution_count": 399,
"execution_count": 147,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -8937,24 +8966,24 @@
},
{
"cell_type": "code",
"execution_count": 400,
"execution_count": 148,
"id": "d2024f35",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'ModelArn': 'arn:aws:sagemaker:us-east-1:325223348818:model/shadow-penguins-endpoint-shadow-0330155951',\n",
" 'ResponseMetadata': {'RequestId': 'b64e8acb-80f7-45c5-9562-adb49a729f68',\n",
"{'ModelArn': 'arn:aws:sagemaker:us-east-1:325223348818:model/shadow-penguins-endpoint-shadow-0331125310',\n",
" 'ResponseMetadata': {'RequestId': '21aaeb87-98e5-49c3-8912-1143ef75f86c',\n",
" 'HTTPStatusCode': 200,\n",
" 'HTTPHeaders': {'x-amzn-requestid': 'b64e8acb-80f7-45c5-9562-adb49a729f68',\n",
" 'HTTPHeaders': {'x-amzn-requestid': '21aaeb87-98e5-49c3-8912-1143ef75f86c',\n",
" 'content-type': 'application/x-amz-json-1.1',\n",
" 'content-length': '104',\n",
" 'date': 'Sat, 30 Mar 2024 19:59:53 GMT'},\n",
" 'date': 'Sun, 31 Mar 2024 16:53:13 GMT'},\n",
" 'RetryAttempts': 0}}"
]
},
"execution_count": 400,
"execution_count": 148,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -8989,7 +9018,7 @@
},
{
"cell_type": "code",
"execution_count": 136,
"execution_count": 149,
"id": "85769b3e",
"metadata": {},
"outputs": [],
Expand All @@ -9007,24 +9036,24 @@
},
{
"cell_type": "code",
"execution_count": 439,
"execution_count": 150,
"id": "969df4f8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'EndpointConfigArn': 'arn:aws:sagemaker:us-east-1:325223348818:endpoint-config/shadow-penguins-endpoint-config-0330155951',\n",
" 'ResponseMetadata': {'RequestId': '7b3f1a13-9ecf-4228-994a-aef801fd31a6',\n",
"{'EndpointConfigArn': 'arn:aws:sagemaker:us-east-1:325223348818:endpoint-config/shadow-penguins-endpoint-config-0331125310',\n",
" 'ResponseMetadata': {'RequestId': '24973c88-6726-4737-ae91-1138b77f5775',\n",
" 'HTTPStatusCode': 200,\n",
" 'HTTPHeaders': {'x-amzn-requestid': '7b3f1a13-9ecf-4228-994a-aef801fd31a6',\n",
" 'HTTPHeaders': {'x-amzn-requestid': '24973c88-6726-4737-ae91-1138b77f5775',\n",
" 'content-type': 'application/x-amz-json-1.1',\n",
" 'content-length': '123',\n",
" 'date': 'Sat, 30 Mar 2024 21:25:47 GMT'},\n",
" 'date': 'Sun, 31 Mar 2024 16:53:17 GMT'},\n",
" 'RetryAttempts': 0}}"
]
},
"execution_count": 439,
"execution_count": 150,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -9080,24 +9109,24 @@
},
{
"cell_type": "code",
"execution_count": 440,
"execution_count": 151,
"id": "33e8d886",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'EndpointArn': 'arn:aws:sagemaker:us-east-1:325223348818:endpoint/shadow-penguins-endpoint',\n",
" 'ResponseMetadata': {'RequestId': '65f7c1b4-06ae-4ace-ad66-83a3bacf8511',\n",
" 'ResponseMetadata': {'RequestId': 'df5ebd20-f59f-4895-96f4-18da3beb0cc4',\n",
" 'HTTPStatusCode': 200,\n",
" 'HTTPHeaders': {'x-amzn-requestid': '65f7c1b4-06ae-4ace-ad66-83a3bacf8511',\n",
" 'HTTPHeaders': {'x-amzn-requestid': 'df5ebd20-f59f-4895-96f4-18da3beb0cc4',\n",
" 'content-type': 'application/x-amz-json-1.1',\n",
" 'content-length': '92',\n",
" 'date': 'Sat, 30 Mar 2024 21:25:49 GMT'},\n",
" 'date': 'Sun, 31 Mar 2024 16:53:21 GMT'},\n",
" 'RetryAttempts': 0}}"
]
},
"execution_count": 440,
"execution_count": 151,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -9123,7 +9152,7 @@
},
{
"cell_type": "code",
"execution_count": 442,
"execution_count": 152,
"id": "069afdae",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -9182,7 +9211,7 @@
"\n",
"Let's check the location where the endpoint stores the captured data, download a file, and display its content. It may take a few minutes for the first few files to show up in S3.\n",
"\n",
"The endpoint will capture the data for both the Production and the Shadow variants."
"The endpoint will capture the data for both the Production and the Shadow variants.\n"
]
},
{
Expand Down Expand Up @@ -9309,85 +9338,9 @@
"id": "28f5d383-fcd7-454c-bbd6-ce4ce7b2104a",
"metadata": {},
"source": [
"## Tearing Down Resources\n",
"## Deleting the Endpoint\n",
"\n",
"After testing the endpoint, we need to ensure we delete it along with any other resources we created.\n"
]
},
{
"cell_type": "markdown",
"id": "468143a0",
"metadata": {},
"source": [
"Let's start by deleting the Data Monitoring Job if we have one:\n"
]
},
{
"cell_type": "code",
"execution_count": 404,
"id": "0df2cbb1",
"metadata": {
"tags": [
"hide-output"
]
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:sagemaker:Deleting Monitoring Schedule with name: penguins-data-monitoring-schedule\n",
"INFO:sagemaker.model_monitor.model_monitoring:Deleting Data Quality Job Definition with name: data-quality-job-definition-2024-03-30-17-36-05-840\n"
]
}
],
"source": [
"try:\n",
" data_monitor.delete_monitoring_schedule()\n",
"except Exception as e:\n",
" print(e)"
]
},
{
"cell_type": "markdown",
"id": "e3c891d9",
"metadata": {},
"source": [
"Delete the Model Monitoring Job if we have one:\n"
]
},
{
"cell_type": "code",
"execution_count": 405,
"id": "dee9a67f",
"metadata": {
"tags": [
"hide-output"
]
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:sagemaker:Deleting Monitoring Schedule with name: penguins-model-monitoring-schedule\n",
"INFO:sagemaker.model_monitor.model_monitoring:Deleting Model Quality Job Definition with name: model-quality-job-definition-2024-03-30-18-54-07-230\n"
]
}
],
"source": [
"try:\n",
" model_monitor.delete_monitoring_schedule()\n",
"except Exception as e:\n",
" print(e)"
]
},
{
"cell_type": "markdown",
"id": "7a6e761a",
"metadata": {},
"source": [
"Delete the endpoint:\n"
"After testing the endpoint, we need to ensure we delete it.\n"
]
},
{
Expand Down

0 comments on commit 10e8bf8

Please sign in to comment.