I am able to follow the instructions in https://docs.aws.amazon.com/glue/latest/dg/monitor-continuous-logging-enable.html, and log messages in driver. But when I try to use the logger inside the map function like this
sc = SparkContext()
glueContext = GlueContext(sc)
logger = glueContext.get_logger()
logger.info("starting glue job...") #successful
...
def transform(item):
logger.info("starting transform...") #error
...transform logics...
Map.apply(frame = dynamicFrame, f = transform)
I get this error:
PicklingError: Could not serialize object: TypeError: can't pickle _thread.RLock objects
I researched around and the message implies that the logger object cannot be serialized when passed to the worker.
What's the correct way to do logging in AWS Glue worker?