Skip to content

Commit

Permalink
Inference recommender fix typos (aws#3226)
Browse files Browse the repository at this point in the history
* Changed FailedReason to FailureReason in JSON query

* Fixed inference typo in failure print statements

* replaced client with inference_client

Co-authored-by: Aaron Markham <[email protected]>
  • Loading branch information
2 people authored and atqy committed Oct 28, 2022
1 parent 4955fce commit e117b35
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions sagemaker-inference-recommender/inference-recommender.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -676,11 +676,11 @@
"import uuid\n",
"from sagemaker import get_execution_role\n",
"\n",
"client = boto3.client(\"sagemaker\", region)\n",
"inference_client = boto3.client(\"sagemaker\", region)\n",
"\n",
"role = get_execution_role()\n",
"default_job = uuid.uuid1()\n",
"default_response = client.create_inference_recommendations_job(\n",
"default_response = inference_client.create_inference_recommendations_job(\n",
" JobName=str(default_job),\n",
" JobDescription=\"\",\n",
" JobType=\"Default\",\n",
Expand Down Expand Up @@ -721,20 +721,22 @@
"import pprint\n",
"import pandas as pd\n",
"\n",
"finished = False\n",
"while not finished:\n",
" inference_recommender_job = sm_client.describe_inference_recommendations_job(\n",
"inference_client = boto3.client(\"sagemaker\", region)\n",
"\n",
"stopped = False\n",
"while not stopped:\n",
" inference_recommender_job = inference_client.describe_inference_recommendations_job(\n",
" JobName=str(default_job)\n",
" )\n",
" if inference_recommender_job[\"Status\"] in [\"COMPLETED\", \"STOPPED\", \"FAILED\"]:\n",
" finished = True\n",
" else:\n",
" print(\"In progress\")\n",
" print(\"Inference recommender job in progress\")\n",
" time.sleep(300)\n",
"\n",
"if inference_recommender_job[\"Status\"] == \"FAILED\":\n",
" print(\"Inference recommender job failed \")\n",
" print(\"Failed Reason: {}\".format(inference_recommender_job[\"FailureReason\"]))\n",
" print(\"Failed Reason: {}\".inference_recommender_job[\"FailureReason\"])\n",
"else:\n",
" print(\"Inference recommender job completed\")"
]
Expand Down Expand Up @@ -793,9 +795,14 @@
"metadata": {},
"outputs": [],
"source": [
"import boto3\n",
"import uuid\n",
"\n",
"inference_client = boto3.client(\"sagemaker\", region)\n",
"\n",
"role = get_execution_role()\n",
"advanced_job = uuid.uuid1()\n",
"advanced_response = sm_client.create_inference_recommendations_job(\n",
"advanced_response = inference_client.create_inference_recommendations_job(\n",
" JobName=str(advanced_job),\n",
" JobDescription=\"\",\n",
" JobType=\"Advanced\",\n",
Expand Down Expand Up @@ -841,20 +848,27 @@
"metadata": {},
"outputs": [],
"source": [
"finished = False\n",
"while not finished:\n",
" inference_recommender_job = sm_client.describe_inference_recommendations_job(\n",
"import boto3\n",
"import uuid\n",
"import pprint\n",
"import pandas as pd\n",
"\n",
"inference_client = boto3.client(\"sagemaker\", region)\n",
"\n",
"stopped = False\n",
"while not stopped:\n",
" inference_recommender_job = inference_client.describe_inference_recommendations_job(\n",
" JobName=str(advanced_job)\n",
" )\n",
" if inference_recommender_job[\"Status\"] in [\"COMPLETED\", \"STOPPED\", \"FAILED\"]:\n",
" finished = True\n",
" else:\n",
" print(\"In progress\")\n",
" print(\"Inference recommender job in progress\")\n",
" time.sleep(300)\n",
"\n",
"if inference_recommender_job[\"Status\"] == \"FAILED\":\n",
" print(\"Inference recommender job failed \")\n",
" print(\"Failed Reason: {}\".format(inference_recommender_job[\"FailureReason\"]))\n",
" print(\"Failed Reason: {}\".inference_recommender_job[\"FailureReason\"])\n",
"else:\n",
" print(\"Inference recommender job completed\")"
]
Expand Down

0 comments on commit e117b35

Please sign in to comment.