Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIP-72: Handling SystemExit from task sdk #45282

Merged
merged 3 commits into from
Dec 30, 2024

Conversation

amoghrajesh
Copy link
Contributor

PR: #45106 provides a machinery to handle "failure" / "retry" states in the execution API server itself.

The aim of this PR is to extend to the "SystemExit" exception if thrown by tasks.

Testing results

DAG used (with and without retries):

import sys
from time import sleep

from airflow import DAG
from airflow.providers.standard.operators.python import PythonOperator


def print_hello():
    sleep(10)
    print("exiting with code 10")
    exit(10)

with DAG(
    dag_id="exitcode",
    schedule=None,
    catchup=False,
    tags=["demo"],
) as dag:
    hello_task = PythonOperator(
        task_id="exitcode-task",
        retries=2,
        python_callable=print_hello,
    )

Behaviour in legacy (non task sdk):

With retries configured
image (8)
image (9)

Without retries configured
image
image

Behaviour in task sdk:

With retries configured
image (10)
image (11)

Without retries configured
image
image


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@amoghrajesh amoghrajesh self-assigned this Dec 30, 2024
@amoghrajesh amoghrajesh requested a review from jscheffl December 30, 2024 09:50
@amoghrajesh amoghrajesh changed the title Handling SystemExit from task sdk AIP-72: Handling SystemExit from task sdk Dec 30, 2024
@amoghrajesh amoghrajesh requested a review from kaxil December 30, 2024 10:08
@amoghrajesh
Copy link
Contributor Author

Merging this, its a simple one

@amoghrajesh amoghrajesh merged commit d22684c into apache:main Dec 30, 2024
44 checks passed
@amoghrajesh amoghrajesh deleted the systemexit branch December 30, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants