Skip to content

Commit a8d7562

Browse files
sunil19myijiezh
authored andcommitted
Fix region issue (#888)
* Region for the sagemaker ecs was hardcoded to us-west-2. Making it available in all regions * To make the notebook always in sync with the one released from the deepracer dashboard. The latest simapp is downloaded. This broke with the new release. This requires the kinesis video to be created else the robomaker job will fail. Made the necessary fix.
1 parent 3de4233 commit a8d7562

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

reinforcement_learning/common/markdown_helper.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
# language governing permissions and limitations under the License.
1313

1414
def generate_s3_write_permission_for_sagemaker_role(role):
15+
role_name = role.split("/")[-1]
16+
url = "https://console.aws.amazon.com/iam/home#/roles/%s" % role_name
17+
text = "1. Go to IAM console to edit current SageMaker role: [%s](%s).\n" % (role_name, url)
18+
text += "2. Next, go to the `Permissions tab` and click on `Attach Policy.` \n"
19+
text += "3. Search and select `AmazonKinesisVideoStreamsFullAccess` policy\n"
20+
return text
21+
22+
def generate_kinesis_create_permission_for_sagemaker_role(role):
1523
role_name = role.split("/")[-1]
1624
url = "https://console.aws.amazon.com/iam/home#/roles/%s" % role_name
1725
text = "1. Go to IAM console to edit current SageMaker role: [%s](%s).\n" % (role_name, url)
@@ -190,4 +198,5 @@ def generate_help_for_experiment_manager_permissions(role):
190198
]
191199
},```\n"""
192200
text += "4. Now wait for a few minutes before executing this cell again!"
193-
return text
201+
return text
202+

reinforcement_learning/rl_deepracer_robomaker_coach_gazebo/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# This is the custom docker image used in the sagemaker container
33
#
44
ARG CPU_OR_GPU
5-
FROM 520713654638.dkr.ecr.us-west-2.amazonaws.com/sagemaker-tensorflow-scriptmode:1.12.0-$CPU_OR_GPU-py3
5+
ARG AWS_REGION
6+
FROM 520713654638.dkr.ecr.$AWS_REGION.amazonaws.com/sagemaker-tensorflow-scriptmode:1.12.0-$CPU_OR_GPU-py3
67

78
RUN apt-get update && apt-get install -y --no-install-recommends \
89
build-essential \
@@ -62,4 +63,4 @@ WORKDIR /opt/ml/code
6263

6364
ENV NODE_TYPE SAGEMAKER_TRAINING_WORKER
6465

65-
ENV PYTHONUNBUFFERED 1
66+
ENV PYTHONUNBUFFERED 1

reinforcement_learning/rl_deepracer_robomaker_coach_gazebo/deepracer_rl.ipynb

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,24 @@
210210
"display(Markdown(generate_s3_write_permission_for_sagemaker_role(sagemaker_role)))"
211211
]
212212
},
213+
{
214+
"cell_type": "markdown",
215+
"metadata": {},
216+
"source": [
217+
"### Permission setup for Sagemaker to create KinesisVideoStreams\n",
218+
"\n",
219+
"The sagemaker notebook has to create a kinesis video streamer. You can observer the car making epsiodes in the kinesis video streamer."
220+
]
221+
},
222+
{
223+
"cell_type": "code",
224+
"execution_count": null,
225+
"metadata": {},
226+
"outputs": [],
227+
"source": [
228+
"display(Markdown(generate_kinesis_create_permission_for_sagemaker_role(sagemaker_role)))"
229+
]
230+
},
213231
{
214232
"cell_type": "markdown",
215233
"metadata": {},
@@ -488,6 +506,25 @@
488506
"print(\"Training job: %s\" % job_name)"
489507
]
490508
},
509+
{
510+
"cell_type": "markdown",
511+
"metadata": {},
512+
"source": [
513+
"### Create the Kinesis video stream"
514+
]
515+
},
516+
{
517+
"cell_type": "code",
518+
"execution_count": null,
519+
"metadata": {},
520+
"outputs": [],
521+
"source": [
522+
"kvs_stream_name = \"dr-kvs-{}\".format(job_name)\n",
523+
"\n",
524+
"!aws --region {aws_region} kinesisvideo create-stream --stream-name {kvs_stream_name} --media-type video/h264 --data-retention-in-hours 24\n",
525+
"print (\"Created kinesis video stream {}\".format(kvs_stream_name))"
526+
]
527+
},
491528
{
492529
"cell_type": "markdown",
493530
"metadata": {},
@@ -600,7 +637,7 @@
600637
"\n",
601638
"envriron_vars = {\n",
602639
" \"WORLD_NAME\": \"reinvent_base\",\n",
603-
" \"KINESIS_VIDEO_STREAM_NAME\": \"SilverstoneStream\",\n",
640+
" \"KINESIS_VIDEO_STREAM_NAME\": kvs_stream_name,\n",
604641
" \"SAGEMAKER_SHARED_S3_BUCKET\": s3_bucket,\n",
605642
" \"SAGEMAKER_SHARED_S3_PREFIX\": s3_prefix,\n",
606643
" \"TRAINING_JOB_ARN\": job_name,\n",

0 commit comments

Comments
 (0)