Is there a way to remove zombies in airflow

I’m making an airflow program that needs to convert .tsv to .parquet
But I have an error:

ERROR – Detected zombie job: {‘full_filepath’: ‘/opt/airflow/dags/formatting_data.py’, ‘processor_subdir’: ‘/opt/airflow/dags’, ‘msg’: “{‘DAG Id’: ‘formatting_data’, ‘Task Id’: ‘format_imdb_data’, ‘Run Id’: ‘scheduled__2024-05-11T00:00:00+00:00’, ‘Hostname’: ‘dd0bbc46b6fa’}”, ‘simple_task_instance’: <airflow.models.taskinstance.SimpleTaskInstance object at 0xffff937ba850>, ‘is_failure_callback’: True}

and my DAG cuts itself in the middle

I made a class that manages my python files:

class FileHandler:
    def convert_csv_to_parquet(self, csv_file):
        df = pd.read_csv(csv_file)
        parquet_file = csv_file.replace(".csv", ".parquet")
        df.to_parquet(parquet_file)
        return df

    def convert_tsv_to_parquet(self, tsv_file):
        df = pd.read_csv(tsv_file, sep='t')
        parquet_file = tsv_file.replace(".tsv", ".parquet")
        df.to_parquet(parquet_file)
        os.remove(tsv_file)
        return df

    def list_files_in_directory(self, directory, extension='.tsv'):
        tsv_files = []
        for root, dirs, files in os.walk(directory):
            for file in files:
                if file.endswith(extension):
                    tsv_files.append(os.path.join(root, file))
        return tsv_files

    def remove_empty_directory(self, path):
        for root, dirs, _ in os.walk(path, topdown=False):
            for directory in dirs:
                directory_path = os.path.join(root, directory)
                if not os.listdir(directory_path):
                    os.rmdir(directory_path)

    def move_files(self, files, destination, remove_dir_flags=True):
        for file in files:
            shutil.move(file, destination)

        if remove_dir_flags:
            self.remove_empty_directory(destination)

my DAG is :

from datetime import datetime, timedelta

import pandas as pd
from airflow import DAG
from airflow.operators.python import PythonOperator
import os
import sys

LIBS_PATH = os.path.join('/opt/airflow', 'libs')
if LIBS_PATH not in sys.path:
    sys.path.insert(0, LIBS_PATH)


from preprocessing.formatting.file_handler import FileHandler
from utils.logs_manager import LogManager
from utils.path_manager import PathManager

file_handler = FileHandler()
lm = LogManager()

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

dag = DAG(
    'formatting_data',
    default_args=default_args,
    description='DAG used to format data in datalake',
    schedule_interval='@daily',
    start_date=datetime(2024, 5, 7),
    catchup=False,
    tags=["formatting", "preprocessing"]
)


def format_imdb_files():
    pm = PathManager('/opt/airflow/datalake')
    imdb_path = pm.get_local_path('raw', 'imdb')
    for file in os.listdir(imdb_path):
        if file.endswith('.tsv'):
            file_path = os.path.join(imdb_path, file)
            df = pd.read_csv(file_path, sep='t')
            parquet_file = file_path.replace(".tsv", ".parquet")
            df.to_parquet(parquet_file)
            os.remove(file_path)
            del df

format_imdb_data = PythonOperator(
    task_id='format_imdb_data',
    python_callable=format_imdb_files,
    dag=dag,
)

format_imdb_data

I don’t understand why I get this error and how to solve it
Thanks a lot for your help !!

New contributor

PaulZouzou 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