0
votes

I have a problem trying to execute aws example fro Aws Glue Etl - locally

after read all those steps: https://docs.aws.amazon.com/glue/latest/dg/dev-endpoint-tutorial-local-notebook.html

and create my endpoints into aws glue. When i try to execute this code:

%pyspark
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


# sc = SparkContext()
#glueContext = GlueContext(sc)

glueContext = GlueContext(SparkContext.getOrCreate())
spark = glueContext.spark_session




persons = glueContext.create_dynamic_frame.from_catalog(
        database="sampledb",
        table_name="avro_avro_files"
    )


print(persons.count())
persons.printSchema()

I have this error:

File "/usr/share/aws/glue/etl/python/PyGlue.zip/awsglue/__init__.py", line 13, in <module>
    from dynamicframe import DynamicFrame
ImportError: No module named 'dynamicframe'

And i don't know how solve this problem

i'm have zeppeling0.7.3 config locally.

the idea with the code showed before is , get this result:

2019-04-01 11:37:22 INFO avro-test-bo: Test log message
Count: 5
root
|-- name: string
|-- favorite_number: int
|-- favorite_color: string

enter image description here

2

2 Answers

1
votes

Hello finally i get the answer here

the problem is when i create my endpoint , i create it just on a private network. After create a new endpoint with public network. this error was solved.

Thanks for the help for everybody

Regards

0
votes

do you mean to say the code was working earlier, and have stopped working? sorry couldnt interpret it correctly.

With reference to local development using Zeppelin, can you please confirm if the configuration is correct, and have enabled ssh tunneling, etc? You may need to do some config. changes in the Zeppelin->Spark interpreters, etc.

Please make sure you are connected to AWS Glue DEP using SSH tunneling. Here are some references that may help you. Looks like your zeppelin is unable to get a GlueContext (I dont see a glueconext object being created?)

# Create a Glue context
glueContext = GlueContext(SparkContext.getOrCreate())

Please refer to this linke, setting up zeppelin on windows, for any help on configuring local zeppelin environment.