PySpark Job Fails with Executor Lost Error on AWS Glue

I’m running a PySpark job on AWS Glue, and it sometimes fails with an “Executor Lost” error. The job reads data from an S3 bucket, processes it, and writes the output back to another S3 location. The goal of the job is to remove the last partition and consolidate the data into a single Parquet file. Here is the relevant part of my code:

    import sys
    from awsglue.job import Job
    from awsglue.transforms import *
    from awsglue.utils import getResolvedOptions
    from pyspark.context import SparkContext
    from awsglue.context import GlueContext
    from pyspark.sql import SparkSession
    from pyspark.conf import SparkConf
    from pyspark.sql.functions import col

    def main():
        args = getResolvedOptions(sys.argv, ['JOB_NAME'])
        sc = SparkContext()
        glueContext = GlueContext(sc)
        job = Job(glueContext)
        job.init(args['JOB_NAME'], args)
        spark = glueContext.spark_session

        input_path = "s3://your-bucket-name/your-input-directory/"

        df = spark.read 
            .option("mergeSchema", "true") 
            .parquet(input_path) 
            .drop("year_month")

        df 
        .repartition("key1", "key2", "key3") 
        .write 
        .mode("overwrite") 
        .partitionBy("key1", "key2", "key3") 
        .option("compression", "snappy") 
        .parquet("s3://your-bucket-name/your-output-directory/")

        job.commit()

    if __name__ == '__main__':
        main()

Error Details:

The job fails with the following error message:

Lost executor 51 on 10.30.46.91: Remote RPC client disassociated. Likely due to containers exceeding thresholds, or network issues. Check driver logs for WARN messages.

The job takes ~1 hour to fail or to succeed. Wether it fails or succeeds the log displays several of those messages. The entire source dataset has ~10GB with ~1250 with partition file sizes ranging from 4MB to 20MB. The output dataset has 5 partitions with file shrunk to ~70MB. The underlying dataframe has ~70k columns with 20 years of a daily series line index.

Also it seems that only in the beggining of the job all workers are used. They are mostly removed and only one kept until the end of the job.

What I’ve Tried:

  • Adjusting the number of partitions on repartitioning.
  • Using coalesce and removing mergeSchema
  • Ensuring that the data is properly partitioned and sorted.
  • Using the G2X worker instance types with up to 20 workers

Job Objective:
The primary objective of this job is to remove the last partition and consolidate the data into a single Parquet file. This involves reading the data from the source S3 bucket, dropping the ‘year_month’ column, repartitioning the data based on three other keys, and then writing the consolidated data back to a different S3 location.

Questions:

  • What could be causing the “Executor Lost” error in this context?
  • How can I optimize the job to handle large data processing without losing executors?
  • Are there specific configurations in AWS Glue or PySpark that I should consider adjusting?

Any insights or suggestions would be greatly appreciated!

New contributor

Felipe Francesco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật