11

Unable to run the AWS Glue Sagemaker Notebook, it's throwing up an error on the start up. Could anyone please let me know if I miss anything here?

PS: As recommended in the error logs, I've restarted the kernel a couple of times but it did not help.

import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job

glueContext = GlueContext(SparkContext.getOrCreate())

Error

The code failed because of a fatal error:
    Error sending http request and maximum retry encountered..

Some things to try:
a) Make sure Spark has enough available resources for Jupyter to create a Spark context.
b) Contact your Jupyter administrator to make sure the Spark magics library is configured correctly.
c) Restart the kernel.
ppwater
  • 2,315
  • 4
  • 15
  • 29
Naga Budigam
  • 689
  • 1
  • 10
  • 26

2 Answers2

0

So I was having this exact same problem on an existing SageMaker Notebook I had in my AWS account.

The notebook status was in "Ready" ever since I created it the first time, few weeks ago.

Literally stopping and restarting it made the problem go away.

wtfzambo
  • 578
  • 1
  • 12
  • 21
0

Had the same issue a couple hours ago while I was following this tutorial.

Found the solution here

If you are using a docker container just run the following:

docker run -itd -p 8888:8888 -p 4040:4040 -v ~/.aws:/root/.aws:ro --name glue_jupyter --ulimit nofile=122880:122880 -m 3G amazon/aws-glue-libs:glue_libs_1.0.0_image_01 /home/jupyter/jupyter_start.sh

Explanation

Docker ulimits limit a program's resource utilization to prevent a run-away bug or security breach from bringing the whole system down

What happened was that the container ended up using more resources than it should so it ran out of memory.

How can I tell that this is the problem?

Try running spark's cli from inside the container and check if an error message like the following shows up:

unable to allocate file descriptor table - out of memory

What happened in my case was that I used docker's precompiled package from AUR in ArchLinux, which comes with the ulimit flag set to a lower value than the default.