diff --git a/sagemaker-inference-recommender/inference-recommender.ipynb b/sagemaker-inference-recommender/inference-recommender.ipynb index f493ed319c..8c6fa80beb 100644 --- a/sagemaker-inference-recommender/inference-recommender.ipynb +++ b/sagemaker-inference-recommender/inference-recommender.ipynb @@ -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", @@ -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\")" ] @@ -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", @@ -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\")" ]