diff --git a/example_notebooks/inference_and_resource_chaining.ipynb b/example_notebooks/inference_and_resource_chaining.ipynb index 140aa8f..12c1dd1 100644 --- a/example_notebooks/inference_and_resource_chaining.ipynb +++ b/example_notebooks/inference_and_resource_chaining.ipynb @@ -70,133 +70,34 @@ }, { "cell_type": "code", - "metadata": { - "ExecuteTime": { - "end_time": "2024-09-13T22:09:42.136289Z", - "start_time": "2024-09-13T22:09:41.667946Z" - } - }, + "metadata": {}, "source": [ "# Uninstall previous version of sagemaker-core and restart kernel\n", "!pip uninstall sagemaker-core -y" ], - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Found existing installation: sagemaker-core 0.1.1\r\n", - "Not uninstalling sagemaker-core at /Users/nargokul/workspace/sagemaker-core/src, outside environment /Users/nargokul/workspace/sagemaker-core/venv\r\n", - "Can't uninstall 'sagemaker-core'. No files were found to uninstall.\r\n" - ] - } - ], - "execution_count": 1 + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "metadata": { - "ExecuteTime": { - "end_time": "2024-09-13T22:09:43.658811Z", - "start_time": "2024-09-13T22:09:42.141782Z" - } - }, + "metadata": {}, "source": [ "# Install the latest version of sagemaker-core\n", "\n", "!pip install sagemaker-core --upgrade" ], - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: sagemaker-core in /Users/nargokul/workspace/sagemaker-core/src (0.1.1)\r\n", - "Collecting sagemaker-core\r\n", - " Downloading sagemaker_core-1.0.4-py3-none-any.whl (377 kB)\r\n", - "\u001B[2K \u001B[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001B[0m \u001B[32m377.9/377.9 kB\u001B[0m \u001B[31m8.9 MB/s\u001B[0m eta \u001B[36m0:00:00\u001B[0m00:01\u001B[0m\r\n", - "\u001B[?25hRequirement already satisfied: rich<14.0.0,>=13.0.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from sagemaker-core) (13.7.1)\r\n", - "Requirement already satisfied: importlib-metadata<7.0,>=1.4.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from sagemaker-core) (6.11.0)\r\n", - "Requirement already satisfied: boto3<2.0.0,>=1.34.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from sagemaker-core) (1.34.156)\r\n", - "Requirement already satisfied: PyYAML<7.0,>=6.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from sagemaker-core) (6.0.1)\r\n", - "Requirement already satisfied: pydantic<3.0.0,>=1.7.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from sagemaker-core) (2.7.3)\r\n", - "Requirement already satisfied: platformdirs<5.0.0,>=4.0.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from sagemaker-core) (4.2.2)\r\n", - "Requirement already satisfied: mock<5.0,>4.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from sagemaker-core) (4.0.3)\r\n", - "Requirement already satisfied: jsonschema<5.0.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from sagemaker-core) (4.22.0)\r\n", - "Requirement already satisfied: botocore<1.35.0,>=1.34.156 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from boto3<2.0.0,>=1.34.0->sagemaker-core) (1.34.156)\r\n", - "Requirement already satisfied: s3transfer<0.11.0,>=0.10.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from boto3<2.0.0,>=1.34.0->sagemaker-core) (0.10.1)\r\n", - "Requirement already satisfied: jmespath<2.0.0,>=0.7.1 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from boto3<2.0.0,>=1.34.0->sagemaker-core) (1.0.1)\r\n", - "Requirement already satisfied: zipp>=0.5 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from importlib-metadata<7.0,>=1.4.0->sagemaker-core) (3.19.2)\r\n", - "Requirement already satisfied: rpds-py>=0.7.1 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from jsonschema<5.0.0->sagemaker-core) (0.18.1)\r\n", - "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from jsonschema<5.0.0->sagemaker-core) (2023.12.1)\r\n", - "Requirement already satisfied: referencing>=0.28.4 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from jsonschema<5.0.0->sagemaker-core) (0.35.1)\r\n", - "Requirement already satisfied: attrs>=22.2.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from jsonschema<5.0.0->sagemaker-core) (23.2.0)\r\n", - "Requirement already satisfied: typing-extensions>=4.6.1 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from pydantic<3.0.0,>=1.7.0->sagemaker-core) (4.12.1)\r\n", - "Requirement already satisfied: annotated-types>=0.4.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from pydantic<3.0.0,>=1.7.0->sagemaker-core) (0.7.0)\r\n", - "Requirement already satisfied: pydantic-core==2.18.4 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from pydantic<3.0.0,>=1.7.0->sagemaker-core) (2.18.4)\r\n", - "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from rich<14.0.0,>=13.0.0->sagemaker-core) (2.18.0)\r\n", - "Requirement already satisfied: markdown-it-py>=2.2.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from rich<14.0.0,>=13.0.0->sagemaker-core) (3.0.0)\r\n", - "Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from botocore<1.35.0,>=1.34.156->boto3<2.0.0,>=1.34.0->sagemaker-core) (2.9.0.post0)\r\n", - "Requirement already satisfied: urllib3<1.27,>=1.25.4 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from botocore<1.35.0,>=1.34.156->boto3<2.0.0,>=1.34.0->sagemaker-core) (1.26.18)\r\n", - "Requirement already satisfied: mdurl~=0.1 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from markdown-it-py>=2.2.0->rich<14.0.0,>=13.0.0->sagemaker-core) (0.1.2)\r\n", - "Requirement already satisfied: six>=1.5 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.35.0,>=1.34.156->boto3<2.0.0,>=1.34.0->sagemaker-core) (1.16.0)\r\n", - "Installing collected packages: sagemaker-core\r\n", - " Attempting uninstall: sagemaker-core\r\n", - " Found existing installation: sagemaker-core 0.1.1\r\n", - " Not uninstalling sagemaker-core at /Users/nargokul/workspace/sagemaker-core/src, outside environment /Users/nargokul/workspace/sagemaker-core/venv\r\n", - " Can't uninstall 'sagemaker-core'. No files were found to uninstall.\r\n", - "Successfully installed sagemaker-core-1.0.4\r\n", - "\r\n", - "\u001B[1m[\u001B[0m\u001B[34;49mnotice\u001B[0m\u001B[1;39;49m]\u001B[0m\u001B[39;49m A new release of pip available: \u001B[0m\u001B[31;49m22.3.1\u001B[0m\u001B[39;49m -> \u001B[0m\u001B[32;49m24.2\u001B[0m\r\n", - "\u001B[1m[\u001B[0m\u001B[34;49mnotice\u001B[0m\u001B[1;39;49m]\u001B[0m\u001B[39;49m To update, run: \u001B[0m\u001B[32;49mpip install --upgrade pip\u001B[0m\r\n" - ] - } - ], - "execution_count": 2 + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "metadata": { - "ExecuteTime": { - "end_time": "2024-09-13T22:09:44.929035Z", - "start_time": "2024-09-13T22:09:43.769091Z" - } - }, + "metadata": {}, "source": [ "# Check the version of sagemaker-core\n", "!pip show -v sagemaker-core" ], - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Name: sagemaker-core\r\n", - "Version: 0.1.1\r\n", - "Summary: An python package for sagemaker core functionalities\r\n", - "Home-page: \r\n", - "Author: \r\n", - "Author-email: AWS \r\n", - "License: \r\n", - "Location: /Users/nargokul/workspace/sagemaker-core/src\r\n", - "Requires: boto3, jsonschema, platformdirs, pydantic, PyYAML\r\n", - "Required-by: \r\n", - "Metadata-Version: 2.1\r\n", - "Installer: \r\n", - "Classifiers:\r\n", - " Development Status :: 3 - Alpha\r\n", - " Intended Audience :: Developers\r\n", - " License :: OSI Approved :: Apache Software License 2.0\r\n", - " Programming Language :: Python :: 3.8\r\n", - " Programming Language :: Python :: 3.9\r\n", - " Programming Language :: Python :: 3.10\r\n", - "Entry-points:\r\n", - "Project-URLs:\r\n", - " Repository, https://github.com/aws/sagemaker-core.git\r\n" - ] - } - ], - "execution_count": 3 + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -207,66 +108,14 @@ }, { "cell_type": "code", - "metadata": { - "ExecuteTime": { - "end_time": "2024-09-13T22:09:52.822516Z", - "start_time": "2024-09-13T22:09:44.935869Z" - } - }, + "metadata": {}, "source": [ "# Install additionall packages\n", "\n", "!pip install -U scikit-learn pandas boto3" ], - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: scikit-learn in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (1.5.1)\r\n", - "Collecting scikit-learn\r\n", - " Downloading scikit_learn-1.5.2-cp39-cp39-macosx_12_0_arm64.whl (11.0 MB)\r\n", - "\u001B[2K \u001B[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001B[0m \u001B[32m11.0/11.0 MB\u001B[0m \u001B[31m15.9 MB/s\u001B[0m eta \u001B[36m0:00:00\u001B[0m00:01\u001B[0m00:01\u001B[0m\r\n", - "\u001B[?25hRequirement already satisfied: pandas in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (2.2.2)\r\n", - "Requirement already satisfied: boto3 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (1.34.156)\r\n", - "Collecting boto3\r\n", - " Downloading boto3-1.35.19-py3-none-any.whl (139 kB)\r\n", - "\u001B[2K \u001B[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001B[0m \u001B[32m139.2/139.2 kB\u001B[0m \u001B[31m9.1 MB/s\u001B[0m eta \u001B[36m0:00:00\u001B[0m\r\n", - "\u001B[?25hRequirement already satisfied: scipy>=1.6.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from scikit-learn) (1.13.1)\r\n", - "Requirement already satisfied: numpy>=1.19.5 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from scikit-learn) (1.26.4)\r\n", - "Requirement already satisfied: joblib>=1.2.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from scikit-learn) (1.4.2)\r\n", - "Requirement already satisfied: threadpoolctl>=3.1.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from scikit-learn) (3.5.0)\r\n", - "Requirement already satisfied: tzdata>=2022.7 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from pandas) (2024.1)\r\n", - "Requirement already satisfied: pytz>=2020.1 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from pandas) (2024.1)\r\n", - "Requirement already satisfied: python-dateutil>=2.8.2 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from pandas) (2.9.0.post0)\r\n", - "Requirement already satisfied: jmespath<2.0.0,>=0.7.1 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from boto3) (1.0.1)\r\n", - "Collecting botocore<1.36.0,>=1.35.19\r\n", - " Downloading botocore-1.35.19-py3-none-any.whl (12.5 MB)\r\n", - "\u001B[2K \u001B[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001B[0m \u001B[32m12.5/12.5 MB\u001B[0m \u001B[31m13.9 MB/s\u001B[0m eta \u001B[36m0:00:00\u001B[0m00:01\u001B[0m00:01\u001B[0m\r\n", - "\u001B[?25hRequirement already satisfied: s3transfer<0.11.0,>=0.10.0 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from boto3) (0.10.1)\r\n", - "Requirement already satisfied: urllib3<1.27,>=1.25.4 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from botocore<1.36.0,>=1.35.19->boto3) (1.26.18)\r\n", - "Requirement already satisfied: six>=1.5 in /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\r\n", - "Installing collected packages: scikit-learn, botocore, boto3\r\n", - " Attempting uninstall: scikit-learn\r\n", - " Found existing installation: scikit-learn 1.5.1\r\n", - " Uninstalling scikit-learn-1.5.1:\r\n", - " Successfully uninstalled scikit-learn-1.5.1\r\n", - " Attempting uninstall: botocore\r\n", - " Found existing installation: botocore 1.34.156\r\n", - " Uninstalling botocore-1.34.156:\r\n", - " Successfully uninstalled botocore-1.34.156\r\n", - " Attempting uninstall: boto3\r\n", - " Found existing installation: boto3 1.34.156\r\n", - " Uninstalling boto3-1.34.156:\r\n", - " Successfully uninstalled boto3-1.34.156\r\n", - "Successfully installed boto3-1.35.19 botocore-1.35.19 scikit-learn-1.5.2\r\n", - "\r\n", - "\u001B[1m[\u001B[0m\u001B[34;49mnotice\u001B[0m\u001B[1;39;49m]\u001B[0m\u001B[39;49m A new release of pip available: \u001B[0m\u001B[31;49m22.3.1\u001B[0m\u001B[39;49m -> \u001B[0m\u001B[32;49m24.2\u001B[0m\r\n", - "\u001B[1m[\u001B[0m\u001B[34;49mnotice\u001B[0m\u001B[1;39;49m]\u001B[0m\u001B[39;49m To update, run: \u001B[0m\u001B[32;49mpip install --upgrade pip\u001B[0m\r\n" - ] - } - ], - "execution_count": 4 + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -282,12 +131,7 @@ }, { "cell_type": "code", - "metadata": { - "ExecuteTime": { - "end_time": "2024-09-13T22:09:54.647227Z", - "start_time": "2024-09-13T22:09:52.828457Z" - } - }, + "metadata": {}, "source": [ "from sagemaker_core.helper.session_helper import get_execution_role, Session\n", "from rich import print\n", @@ -300,52 +144,8 @@ "bucket = sagemaker_session.default_bucket()\n", "print(role)" ], - "outputs": [ - { - "data": { - "text/plain": [ - "\u001B[2;36m[09/13/24 15:09:53]\u001B[0m\u001B[2;36m \u001B[0m\u001B[1;38;2;0;105;255mINFO \u001B[0m INFO:botocore.credentials:Found credentials in shared credentials \u001B]8;id=993678;file:///Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/botocore/credentials.py\u001B\\\u001B[2mcredentials.py\u001B[0m\u001B]8;;\u001B\\\u001B[2m:\u001B[0m\u001B]8;id=96849;file:///Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/botocore/credentials.py#1278\u001B\\\u001B[2m1278\u001B[0m\u001B]8;;\u001B\\\n", - "\u001B[2;36m \u001B[0m file: ~\u001B[38;2;225;0;225m/.aws/\u001B[0m\u001B[38;2;225;0;225mcredentials\u001B[0m \u001B[2m \u001B[0m\n" - ], - "text/html": [ - "
[09/13/24 15:09:53] INFO     INFO:botocore.credentials:Found credentials in shared credentials  credentials.py:1278\n",
-       "                             file: ~/.aws/credentials                                                              \n",
-       "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "\u001B[2;36m \u001B[0m\u001B[2;36m \u001B[0m\u001B[1;38;2;0;105;255mINFO \u001B[0m INFO:botocore.credentials:Found credentials in shared credentials \u001B]8;id=510202;file:///Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/botocore/credentials.py\u001B\\\u001B[2mcredentials.py\u001B[0m\u001B]8;;\u001B\\\u001B[2m:\u001B[0m\u001B]8;id=561052;file:///Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/botocore/credentials.py#1278\u001B\\\u001B[2m1278\u001B[0m\u001B]8;;\u001B\\\n", - "\u001B[2;36m \u001B[0m file: ~\u001B[38;2;225;0;225m/.aws/\u001B[0m\u001B[38;2;225;0;225mcredentials\u001B[0m \u001B[2m \u001B[0m\n" - ], - "text/html": [ - "
                    INFO     INFO:botocore.credentials:Found credentials in shared credentials  credentials.py:1278\n",
-       "                             file: ~/.aws/credentials                                                              \n",
-       "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "arn:aws:iam::\u001B[1;36m211125564141\u001B[0m:role/Admin\n" - ], - "text/html": [ - "
arn:aws:iam::211125564141:role/Admin\n",
-       "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "execution_count": 5 + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -357,12 +157,7 @@ }, { "cell_type": "code", - "metadata": { - "ExecuteTime": { - "end_time": "2024-09-13T22:10:01.831005Z", - "start_time": "2024-09-13T22:09:54.654267Z" - } - }, + "metadata": {}, "source": [ "from sklearn.datasets import load_iris\n", "from sklearn.model_selection import train_test_split\n", @@ -376,16 +171,11 @@ "iris_df['target'] = iris.target" ], "outputs": [], - "execution_count": 6 + "execution_count": null }, { "cell_type": "code", - "metadata": { - "ExecuteTime": { - "end_time": "2024-09-13T22:10:01.852790Z", - "start_time": "2024-09-13T22:10:01.843506Z" - } - }, + "metadata": {}, "source": [ "import os\n", "\n", @@ -404,7 +194,7 @@ "test_data_no_target = test_data.drop('target', axis=1)" ], "outputs": [], - "execution_count": 7 + "execution_count": null }, { "cell_type": "markdown", @@ -416,12 +206,7 @@ }, { "cell_type": "code", - "metadata": { - "ExecuteTime": { - "end_time": "2024-09-16T23:16:08.659255Z", - "start_time": "2024-09-16T23:16:07.499835Z" - } - }, + "metadata": {}, "source": [ "# Upload Data\n", "\n", @@ -439,322 +224,8 @@ "print(s3_input_path)\n", "print(s3_output_path)" ], - "outputs": [ - { - "data": { - "text/plain": [ - "\u001B[38;2;255;0;0m╭─\u001B[0m\u001B[38;2;255;0;0m──────────────────────────────\u001B[0m\u001B[38;2;255;0;0m \u001B[0m\u001B[1;38;2;255;0;0mTraceback \u001B[0m\u001B[1;2;38;2;255;0;0m(most recent call last)\u001B[0m\u001B[38;2;255;0;0m \u001B[0m\u001B[38;2;255;0;0m───────────────────────────────\u001B[0m\u001B[38;2;255;0;0m─╮\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/boto3/s3/\u001B[0m\u001B[1;33mtransfer.py\u001B[0m:\u001B[94m3\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[94m72\u001B[0m in \u001B[92mupload_file\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m369 \u001B[0m\u001B[2m│ │ │ \u001B[0mfilename, bucket, key, extra_args, subscribers \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m370 \u001B[0m\u001B[2m│ │ \u001B[0m) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m371 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94mtry\u001B[0m: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m372 \u001B[2m│ │ │ \u001B[0mfuture.result() \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m373 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[2m# If a client error was raised, add the backwards compatibility layer\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m374 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[2m# that raises a S3UploadFailedError. These specific errors were only\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m375 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[2m# ever thrown for upload_parts but now can be thrown for any related\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/s3transfer/\u001B[0m\u001B[1;33mfutures.py\u001B[0m: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[94m103\u001B[0m in \u001B[92mresult\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m100 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[2m# Usually the result() method blocks until the transfer is done,\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m101 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[2m# however if a KeyboardInterrupt is raised we want want to exit\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m102 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[2m# out of this and propagate the exception.\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m103 \u001B[2m│ │ │ \u001B[0m\u001B[94mreturn\u001B[0m \u001B[96mself\u001B[0m._coordinator.result() \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m104 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94mexcept\u001B[0m \u001B[96mKeyboardInterrupt\u001B[0m \u001B[94mas\u001B[0m e: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m105 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[96mself\u001B[0m.cancel() \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m106 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[94mraise\u001B[0m e \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/s3transfer/\u001B[0m\u001B[1;33mfutures.py\u001B[0m: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[94m266\u001B[0m in \u001B[92mresult\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m263 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[2m# Once done waiting, raise an exception if present or return the\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m264 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[2m# final result.\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m265 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94mif\u001B[0m \u001B[96mself\u001B[0m._exception: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m266 \u001B[2m│ │ │ \u001B[0m\u001B[94mraise\u001B[0m \u001B[96mself\u001B[0m._exception \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m267 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94mreturn\u001B[0m \u001B[96mself\u001B[0m._result \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m268 \u001B[0m\u001B[2m│ \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m269 \u001B[0m\u001B[2m│ \u001B[0m\u001B[94mdef\u001B[0m \u001B[92mcancel\u001B[0m(\u001B[96mself\u001B[0m, msg=\u001B[33m'\u001B[0m\u001B[33m'\u001B[0m, exc_type=CancelledError): \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/s3transfer/\u001B[0m\u001B[1;33mtasks.py\u001B[0m:\u001B[94m13\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[94m9\u001B[0m in \u001B[92m__call__\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m136 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[2m# task to the TransferFuture had failed) then execute the task's\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m137 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[2m# main() method.\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m138 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[94mif\u001B[0m \u001B[95mnot\u001B[0m \u001B[96mself\u001B[0m._transfer_coordinator.done(): \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m139 \u001B[2m│ │ │ │ \u001B[0m\u001B[94mreturn\u001B[0m \u001B[96mself\u001B[0m._execute_main(kwargs) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m140 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94mexcept\u001B[0m \u001B[96mException\u001B[0m \u001B[94mas\u001B[0m e: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m141 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[96mself\u001B[0m._log_and_set_exception(e) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m142 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94mfinally\u001B[0m: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/s3transfer/\u001B[0m\u001B[1;33mtasks.py\u001B[0m:\u001B[94m16\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[94m2\u001B[0m in \u001B[92m_execute_main\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m159 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[2m# Log what is about to be executed.\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m160 \u001B[0m\u001B[2m│ │ \u001B[0mlogger.debug(\u001B[33mf\u001B[0m\u001B[33m\"\u001B[0m\u001B[33mExecuting task \u001B[0m\u001B[33m{\u001B[0m\u001B[96mself\u001B[0m\u001B[33m}\u001B[0m\u001B[33m with kwargs \u001B[0m\u001B[33m{\u001B[0mkwargs_to_display\u001B[33m}\u001B[0m\u001B[33m\"\u001B[0m) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m161 \u001B[0m\u001B[2m│ │ \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m162 \u001B[2m│ │ \u001B[0mreturn_value = \u001B[96mself\u001B[0m._main(**kwargs) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m163 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[2m# If the task is the final task, then set the TransferFuture's\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m164 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[2m# value to the return value from main().\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m165 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94mif\u001B[0m \u001B[96mself\u001B[0m._is_final: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/s3transfer/\u001B[0m\u001B[1;33mupload.py\u001B[0m:\u001B[94m7\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[94m64\u001B[0m in \u001B[92m_main\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m761 \u001B[0m\u001B[2;33m│ │ │ \u001B[0m\u001B[33mused in the upload.\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m762 \u001B[0m\u001B[2;33m│ │ \u001B[0m\u001B[33m\"\"\"\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m763 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94mwith\u001B[0m fileobj \u001B[94mas\u001B[0m body: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m764 \u001B[2m│ │ │ \u001B[0mclient.put_object(Bucket=bucket, Key=key, Body=body, **extra_args) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m765 \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m766 \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m767 \u001B[0m\u001B[94mclass\u001B[0m \u001B[4;92mUploadPartTask\u001B[0m(Task): \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/botocore/\u001B[0m\u001B[1;33mclient.py\u001B[0m:\u001B[94m569\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m in \u001B[92m_api_call\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 566 \u001B[0m\u001B[2m│ │ │ │ │ \u001B[0m\u001B[33mf\u001B[0m\u001B[33m\"\u001B[0m\u001B[33m{\u001B[0mpy_operation_name\u001B[33m}\u001B[0m\u001B[33m() only accepts keyword arguments.\u001B[0m\u001B[33m\"\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 567 \u001B[0m\u001B[2m│ │ │ │ \u001B[0m) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 568 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[2m# The \"self\" in this scope is referring to the BaseClient.\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m 569 \u001B[2m│ │ │ \u001B[0m\u001B[94mreturn\u001B[0m \u001B[96mself\u001B[0m._make_api_call(operation_name, kwargs) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 570 \u001B[0m\u001B[2m│ │ \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 571 \u001B[0m\u001B[2m│ │ \u001B[0m_api_call.\u001B[91m__name__\u001B[0m = \u001B[96mstr\u001B[0m(py_operation_name) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 572 \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/botocore/\u001B[0m\u001B[1;33mclient.py\u001B[0m:\u001B[94m102\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[94m3\u001B[0m in \u001B[92m_make_api_call\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m1020 \u001B[0m\u001B[2m│ │ │ │ \u001B[0m\u001B[33m\"\u001B[0m\u001B[33mCode\u001B[0m\u001B[33m\"\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m1021 \u001B[0m\u001B[2m│ │ │ \u001B[0m) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m1022 \u001B[0m\u001B[2m│ │ │ \u001B[0merror_class = \u001B[96mself\u001B[0m.exceptions.from_code(error_code) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m1023 \u001B[2m│ │ │ \u001B[0m\u001B[94mraise\u001B[0m error_class(parsed_response, operation_name) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m1024 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94melse\u001B[0m: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m1025 \u001B[0m\u001B[2m│ │ │ \u001B[0m\u001B[94mreturn\u001B[0m parsed_response \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m1026 \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001B[0m\n", - "\u001B[1;91mClientError: \u001B[0mAn error occurred \u001B[1m(\u001B[0mExpiredToken\u001B[1m)\u001B[0m when calling the PutObject operation: The provided token has expired.\n", - "\n", - "\u001B[3mDuring handling of the above exception, another exception occurred:\u001B[0m\n", - "\n", - "\u001B[38;2;255;0;0m╭─\u001B[0m\u001B[38;2;255;0;0m──────────────────────────────\u001B[0m\u001B[38;2;255;0;0m \u001B[0m\u001B[1;38;2;255;0;0mTraceback \u001B[0m\u001B[1;2;38;2;255;0;0m(most recent call last)\u001B[0m\u001B[38;2;255;0;0m \u001B[0m\u001B[38;2;255;0;0m───────────────────────────────\u001B[0m\u001B[38;2;255;0;0m─╮\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m in \u001B[92m\u001B[0m:\u001B[94m7\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 4 \u001B[0mTRAIN_DATA = \u001B[33m\"\u001B[0m\u001B[33mtrain.csv\u001B[0m\u001B[33m\"\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 5 \u001B[0mDATA_DIRECTORY = \u001B[33m\"\u001B[0m\u001B[33mdata\u001B[0m\u001B[33m\"\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 6 \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m 7 train_input = sagemaker_session.upload_data( \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 8 \u001B[0m\u001B[2m│ \u001B[0mDATA_DIRECTORY, bucket=bucket, key_prefix=\u001B[33m\"\u001B[0m\u001B[33m{}\u001B[0m\u001B[33m/\u001B[0m\u001B[33m{}\u001B[0m\u001B[33m\"\u001B[0m.format(prefix, DATA_DIRECTORY) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m 9 \u001B[0m) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m10 \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/src/sagemaker_core/helper/\u001B[0m\u001B[1;33msession_helper.py\u001B[0m:\u001B[94m361\u001B[0m in \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[92mupload_data\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m358 \u001B[0m\u001B[2m│ │ │ \u001B[0ms3 = \u001B[96mself\u001B[0m.s3_resource \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m359 \u001B[0m\u001B[2m│ │ \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m360 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94mfor\u001B[0m local_path, s3_key \u001B[95min\u001B[0m files: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m361 \u001B[2m│ │ │ \u001B[0ms3.Object(bucket, s3_key).upload_file( \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m362 \u001B[0m\u001B[2m│ │ │ │ \u001B[0mlocal_path, Callback=callback, ExtraArgs=extra_args \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m363 \u001B[0m\u001B[2m│ │ │ \u001B[0m) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m364 \u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/boto3/s3/\u001B[0m\u001B[1;33minject.py\u001B[0m:\u001B[94m320\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m in \u001B[92mobject_upload_file\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m317 \u001B[0m\u001B[2;33m│ \u001B[0m\u001B[33m:param Config: The transfer configuration to be used when performing the\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m318 \u001B[0m\u001B[2;33m│ │ \u001B[0m\u001B[33mtransfer.\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m319 \u001B[0m\u001B[2;33m│ \u001B[0m\u001B[33m\"\"\"\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m320 \u001B[2m│ \u001B[0m\u001B[94mreturn\u001B[0m \u001B[96mself\u001B[0m.meta.client.upload_file( \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m321 \u001B[0m\u001B[2m│ │ \u001B[0mFilename=Filename, \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m322 \u001B[0m\u001B[2m│ │ \u001B[0mBucket=\u001B[96mself\u001B[0m.bucket_name, \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m323 \u001B[0m\u001B[2m│ │ \u001B[0mKey=\u001B[96mself\u001B[0m.key, \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/boto3/s3/\u001B[0m\u001B[1;33minject.py\u001B[0m:\u001B[94m145\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m in \u001B[92mupload_file\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m142 \u001B[0m\u001B[2;33m│ │ \u001B[0m\u001B[33mtransfer.\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m143 \u001B[0m\u001B[2;33m│ \u001B[0m\u001B[33m\"\"\"\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m144 \u001B[0m\u001B[2m│ \u001B[0m\u001B[94mwith\u001B[0m S3Transfer(\u001B[96mself\u001B[0m, Config) \u001B[94mas\u001B[0m transfer: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m145 \u001B[2m│ │ \u001B[0m\u001B[94mreturn\u001B[0m transfer.upload_file( \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m146 \u001B[0m\u001B[2m│ │ │ \u001B[0mfilename=Filename, \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m147 \u001B[0m\u001B[2m│ │ │ \u001B[0mbucket=Bucket, \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m148 \u001B[0m\u001B[2m│ │ │ \u001B[0mkey=Key, \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2;33m/Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/boto3/s3/\u001B[0m\u001B[1;33mtransfer.py\u001B[0m:\u001B[94m3\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[94m78\u001B[0m in \u001B[92mupload_file\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m375 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[2m# ever thrown for upload_parts but now can be thrown for any related\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m376 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[2m# client error.\u001B[0m \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m377 \u001B[0m\u001B[2m│ │ \u001B[0m\u001B[94mexcept\u001B[0m ClientError \u001B[94mas\u001B[0m e: \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[31m❱ \u001B[0m378 \u001B[2m│ │ │ \u001B[0m\u001B[94mraise\u001B[0m S3UploadFailedError( \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m379 \u001B[0m\u001B[2m│ │ │ │ \u001B[0m\u001B[33m\"\u001B[0m\u001B[33mFailed to upload \u001B[0m\u001B[33m{}\u001B[0m\u001B[33m to \u001B[0m\u001B[33m{}\u001B[0m\u001B[33m: \u001B[0m\u001B[33m{}\u001B[0m\u001B[33m\"\u001B[0m.format( \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m380 \u001B[0m\u001B[2m│ │ │ │ │ \u001B[0mfilename, \u001B[33m'\u001B[0m\u001B[33m/\u001B[0m\u001B[33m'\u001B[0m.join([bucket, key]), e \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m│\u001B[0m \u001B[2m381 \u001B[0m\u001B[2m│ │ │ │ \u001B[0m) \u001B[38;2;255;0;0m│\u001B[0m\n", - "\u001B[38;2;255;0;0m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001B[0m\n", - "\u001B[1;91mS3UploadFailedError: \u001B[0mFailed to upload data/defaults.json to \n", - "sagemaker-us-west-\u001B[1;36m2\u001B[0m-\u001B[1;36m211125564141\u001B[0m/DEMO-scikit-iris/data/defaults.json: An error occurred \u001B[1m(\u001B[0mExpiredToken\u001B[1m)\u001B[0m when calling\n", - "the PutObject operation: The provided token has expired.\n" - ], - "text/html": [ - "
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/boto3/s3/transfer.py:3 \n",
-       " 72 in upload_file                                                                                \n",
-       "                                                                                                  \n",
-       "   369 │   │   │   filename, bucket, key, extra_args, subscribers                                 \n",
-       "   370 │   │   )                                                                                  \n",
-       "   371 │   │   try:                                                                               \n",
-       " 372 │   │   │   future.result()                                                                \n",
-       "   373 │   │   # If a client error was raised, add the backwards compatibility layer              \n",
-       "   374 │   │   # that raises a S3UploadFailedError. These specific errors were only               \n",
-       "   375 │   │   # ever thrown for upload_parts but now can be thrown for any related               \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/s3transfer/futures.py: \n",
-       " 103 in result                                                                                    \n",
-       "                                                                                                  \n",
-       "   100 │   │   │   # Usually the result() method blocks until the transfer is done,               \n",
-       "   101 │   │   │   # however if a KeyboardInterrupt is raised we want want to exit                \n",
-       "   102 │   │   │   # out of this and propagate the exception.                                     \n",
-       " 103 │   │   │   return self._coordinator.result()                                              \n",
-       "   104 │   │   except KeyboardInterrupt as e:                                                     \n",
-       "   105 │   │   │   self.cancel()                                                                  \n",
-       "   106 │   │   │   raise e                                                                        \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/s3transfer/futures.py: \n",
-       " 266 in result                                                                                    \n",
-       "                                                                                                  \n",
-       "   263 │   │   # Once done waiting, raise an exception if present or return the                   \n",
-       "   264 │   │   # final result.                                                                    \n",
-       "   265 │   │   if self._exception:                                                                \n",
-       " 266 │   │   │   raise self._exception                                                          \n",
-       "   267 │   │   return self._result                                                                \n",
-       "   268                                                                                        \n",
-       "   269 def cancel(self, msg='', exc_type=CancelledError):                                     \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/s3transfer/tasks.py:13 \n",
-       " 9 in __call__                                                                                    \n",
-       "                                                                                                  \n",
-       "   136 │   │   │   # task to the TransferFuture had failed) then execute the task's               \n",
-       "   137 │   │   │   # main() method.                                                               \n",
-       "   138 │   │   │   if not self._transfer_coordinator.done():                                      \n",
-       " 139 │   │   │   │   return self._execute_main(kwargs)                                          \n",
-       "   140 │   │   except Exception as e:                                                             \n",
-       "   141 │   │   │   self._log_and_set_exception(e)                                                 \n",
-       "   142 │   │   finally:                                                                           \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/s3transfer/tasks.py:16 \n",
-       " 2 in _execute_main                                                                               \n",
-       "                                                                                                  \n",
-       "   159 │   │   # Log what is about to be executed.                                                \n",
-       "   160 │   │   logger.debug(f\"Executing task {self} with kwargs {kwargs_to_display}\")             \n",
-       "   161 │   │                                                                                      \n",
-       " 162 │   │   return_value = self._main(**kwargs)                                                \n",
-       "   163 │   │   # If the task is the final task, then set the TransferFuture's                     \n",
-       "   164 │   │   # value to the return value from main().                                           \n",
-       "   165 │   │   if self._is_final:                                                                 \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/s3transfer/upload.py:7 \n",
-       " 64 in _main                                                                                      \n",
-       "                                                                                                  \n",
-       "   761 │   │   │   used in the upload.                                                            \n",
-       "   762 │   │   \"\"\"                                                                                \n",
-       "   763 │   │   with fileobj as body:                                                              \n",
-       " 764 │   │   │   client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args)             \n",
-       "   765                                                                                            \n",
-       "   766                                                                                            \n",
-       "   767 class UploadPartTask(Task):                                                                \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/botocore/client.py:569 \n",
-       " in _api_call                                                                                     \n",
-       "                                                                                                  \n",
-       "    566 │   │   │   │   │   f\"{py_operation_name}() only accepts keyword arguments.\"              \n",
-       "    567 │   │   │   │   )                                                                         \n",
-       "    568 │   │   │   # The \"self\" in this scope is referring to the BaseClient.                    \n",
-       "  569 │   │   │   return self._make_api_call(operation_name, kwargs)                            \n",
-       "    570 │   │                                                                                     \n",
-       "    571 │   │   _api_call.__name__ = str(py_operation_name)                                       \n",
-       "    572                                                                                           \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/botocore/client.py:102 \n",
-       " 3 in _make_api_call                                                                              \n",
-       "                                                                                                  \n",
-       "   1020 │   │   │   │   \"Code\"                                                                    \n",
-       "   1021 │   │   │   )                                                                             \n",
-       "   1022 │   │   │   error_class = self.exceptions.from_code(error_code)                           \n",
-       " 1023 │   │   │   raise error_class(parsed_response, operation_name)                            \n",
-       "   1024 │   │   else:                                                                             \n",
-       "   1025 │   │   │   return parsed_response                                                        \n",
-       "   1026                                                                                           \n",
-       "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
-       "ClientError: An error occurred (ExpiredToken) when calling the PutObject operation: The provided token has expired.\n",
-       "\n",
-       "During handling of the above exception, another exception occurred:\n",
-       "\n",
-       "╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
-       " in <module>:7                                                                                    \n",
-       "                                                                                                  \n",
-       "    4 TRAIN_DATA = \"train.csv\"                                                                    \n",
-       "    5 DATA_DIRECTORY = \"data\"                                                                     \n",
-       "    6                                                                                             \n",
-       "  7 train_input = sagemaker_session.upload_data(                                                \n",
-       "    8 DATA_DIRECTORY, bucket=bucket, key_prefix=\"{}/{}\".format(prefix, DATA_DIRECTORY)        \n",
-       "    9 )                                                                                           \n",
-       "   10                                                                                             \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/src/sagemaker_core/helper/session_helper.py:361 in      \n",
-       " upload_data                                                                                      \n",
-       "                                                                                                  \n",
-       "   358 │   │   │   s3 = self.s3_resource                                                          \n",
-       "   359 │   │                                                                                      \n",
-       "   360 │   │   for local_path, s3_key in files:                                                   \n",
-       " 361 │   │   │   s3.Object(bucket, s3_key).upload_file(                                         \n",
-       "   362 │   │   │   │   local_path, Callback=callback, ExtraArgs=extra_args                        \n",
-       "   363 │   │   │   )                                                                              \n",
-       "   364                                                                                            \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/boto3/s3/inject.py:320 \n",
-       " in object_upload_file                                                                            \n",
-       "                                                                                                  \n",
-       "   317 :param Config: The transfer configuration to be used when performing the               \n",
-       "   318 │   │   transfer.                                                                          \n",
-       "   319 \"\"\"                                                                                    \n",
-       " 320 return self.meta.client.upload_file(                                                   \n",
-       "   321 │   │   Filename=Filename,                                                                 \n",
-       "   322 │   │   Bucket=self.bucket_name,                                                           \n",
-       "   323 │   │   Key=self.key,                                                                      \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/boto3/s3/inject.py:145 \n",
-       " in upload_file                                                                                   \n",
-       "                                                                                                  \n",
-       "   142 │   │   transfer.                                                                          \n",
-       "   143 \"\"\"                                                                                    \n",
-       "   144 with S3Transfer(self, Config) as transfer:                                             \n",
-       " 145 │   │   return transfer.upload_file(                                                       \n",
-       "   146 │   │   │   filename=Filename,                                                             \n",
-       "   147 │   │   │   bucket=Bucket,                                                                 \n",
-       "   148 │   │   │   key=Key,                                                                       \n",
-       "                                                                                                  \n",
-       " /Users/nargokul/workspace/sagemaker-core/venv/lib/python3.9/site-packages/boto3/s3/transfer.py:3 \n",
-       " 78 in upload_file                                                                                \n",
-       "                                                                                                  \n",
-       "   375 │   │   # ever thrown for upload_parts but now can be thrown for any related               \n",
-       "   376 │   │   # client error.                                                                    \n",
-       "   377 │   │   except ClientError as e:                                                           \n",
-       " 378 │   │   │   raise S3UploadFailedError(                                                     \n",
-       "   379 │   │   │   │   \"Failed to upload {} to {}: {}\".format(                                    \n",
-       "   380 │   │   │   │   │   filename, '/'.join([bucket, key]), e                                   \n",
-       "   381 │   │   │   │   )                                                                          \n",
-       "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
-       "S3UploadFailedError: Failed to upload data/defaults.json to \n",
-       "sagemaker-us-west-2-211125564141/DEMO-scikit-iris/data/defaults.json: An error occurred (ExpiredToken) when calling\n",
-       "the PutObject operation: The provided token has expired.\n",
-       "
\n" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "execution_count": 12 + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -766,12 +237,7 @@ }, { "cell_type": "code", - "metadata": { - "ExecuteTime": { - "end_time": "2024-09-13T22:10:02.276140Z", - "start_time": "2024-09-13T22:10:02.273699Z" - } - }, + "metadata": {}, "source": [ "# Image name is hardcoded here\n", "# Image name can be programatically got by using sagemaker package and calling image_uris.retrieve\n", @@ -780,7 +246,7 @@ "image = \"433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest\"" ], "outputs": [], - "execution_count": 9 + "execution_count": null }, { "cell_type": "markdown", @@ -849,12 +315,12 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "training_job.wait()" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -907,9 +373,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "from sagemaker_core.shapes import ContainerDefinition, ProductionVariant\n", "from sagemaker_core.resources import Model, EndpointConfig, Endpoint\n", @@ -929,7 +393,9 @@ " ),\n", " execution_role_arn=role,\n", ")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -940,9 +406,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "endpoint_config = EndpointConfig.create(\n", " endpoint_config_name=key,\n", @@ -960,16 +424,18 @@ " endpoint_name=key,\n", " endpoint_config_name=endpoint_config # Pass `EndpointConfig` object created above\n", ")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "endpoint.wait_for_status(\"InService\")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -984,9 +450,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "from sagemaker.base_serializers import CSVSerializer\n", "from sagemaker.deserializers import CSVDeserializer\n", @@ -1001,7 +465,9 @@ "deserialized_result = deserializer.deserialize(invoke_result['Body'], invoke_result['ContentType'])\n", "\n", "print(\"Endpoint Response:\", deserialized_result)" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -1012,9 +478,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "def deserialise(response):\n", " return [\n", @@ -1028,7 +492,9 @@ " accept='application/csv')\n", "\n", "print(\"Endpoint Stream Response:\", deserialise(invoke_result))" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -1048,9 +514,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "import boto3\n", "import os\n", @@ -1071,7 +535,9 @@ " \"models/async-inference/demo-xgboost-model.tar.gz\",\n", " \"model/demo-xgboost-model.tar.gz\",\n", ")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -1083,9 +549,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "# Upload the model to S3 bucket\n", "bucket_prefix = \"async-inference-demo\"\n", @@ -1097,7 +561,9 @@ "model_url = sagemaker_session.upload_data(\"model/demo-xgboost-model.tar.gz\", bucket, bucket_prefix)\n", "\n", "print(f\"Uploading Model to {model_url}\")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -1115,9 +581,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "key = f'xgboost-iris-{strftime(\"%H-%M-%S\", gmtime())}'\n", "print(\"Key:\", key)\n", @@ -1130,7 +594,9 @@ " ),\n", " execution_role_arn=role,\n", ")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -1141,9 +607,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "from sagemaker_core.shapes import ProductionVariant, AsyncInferenceConfig, AsyncInferenceOutputConfig, AsyncInferenceClientConfig\n", "\n", @@ -1166,16 +630,18 @@ ")\n", "\n", "async_endpoint = Endpoint.create(endpoint_name=key, endpoint_config_name=async_endpoint_config)" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "async_endpoint.wait_for_status(\"InService\")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -1187,9 +653,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "def upload_file(input_location):\n", " prefix = f\"{bucket_prefix}/input\"\n", @@ -1202,7 +666,9 @@ "\n", "input_path = \"input/test_point_0.libsvm\"\n", "input_s3_path = upload_file(input_path)" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -1215,14 +681,14 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "response = async_endpoint.invoke_async(input_location=input_s3_path)\n", "output_location = response[\"OutputLocation\"]\n", "print(output_location)" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -1234,9 +700,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "import urllib, time\n", "from botocore.exceptions import ClientError\n", @@ -1255,17 +719,19 @@ " time.sleep(2)\n", " continue\n", " raise" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "output = get_output(output_location)\n", "print(f\"Output: {output}\")" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -1282,9 +748,7 @@ }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "# Delete any sagemaker core resource objects created in this notebook\n", "def delete_all_sagemaker_resources():\n", @@ -1295,7 +759,9 @@ " obj.delete()\n", " \n", "delete_all_sagemaker_resources()" - ] + ], + "outputs": [], + "execution_count": null } ], "metadata": {