Skip to content

AIP-72: Handling execution_timeout for tasks in task SDK - #45310

Merged
amoghrajesh merged 3 commits into
apache:mainfrom
astronomer:AIP72-tasktimeout
Jan 1, 2025
Merged

AIP-72: Handling execution_timeout for tasks in task SDK#45310
amoghrajesh merged 3 commits into
apache:mainfrom
astronomer:AIP72-tasktimeout

Conversation

@amoghrajesh

Copy link
Copy Markdown
Contributor

closes: #45307

Testing results

DAG:

from time import sleep

from airflow import DAG
from airflow.providers.standard.operators.python import PythonOperator
from datetime import datetime, timedelta


def print_hello():
    print("Going to sleep 100 seconds")
    sleep(100)

with DAG(
    dag_id="tasktimeout",
    schedule=None,
    catchup=False,
) as dag:
    hello_task = PythonOperator(
        task_id="ttimemout",
        execution_timeout=timedelta(seconds=10),
        python_callable=print_hello,
    )

Legacy

  1. No retries
    image (14)

  2. With timeouts
    image (15)

Task sdk

  1. No retries
image
  1. With retries
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.

Comment thread task_sdk/src/airflow/sdk/execution_time/task_runner.py
Comment thread task_sdk/src/airflow/sdk/execution_time/task_runner.py
Comment thread task_sdk/src/airflow/sdk/execution_time/task_runner.py Outdated
Comment thread task_sdk/tests/execution_time/test_task_runner.py
Comment thread task_sdk/src/airflow/sdk/execution_time/task_runner.py
@amoghrajesh amoghrajesh self-assigned this Dec 31, 2024

@jscheffl jscheffl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for me.

Comment thread task_sdk/src/airflow/sdk/execution_time/task_runner.py
@amoghrajesh

Copy link
Copy Markdown
Contributor Author

Will merge this PR with one approval as it is functional. Can handle any issues or shortcomings, if any, in follow ups.

@amoghrajesh
amoghrajesh merged commit 7bbda16 into apache:main Jan 1, 2025
@amoghrajesh
amoghrajesh deleted the AIP72-tasktimeout branch January 1, 2025 05:09
HariGS-DB pushed a commit to HariGS-DB/airflow that referenced this pull request Jan 16, 2025
)

Ports the `execution_timeout` for tasks in legacy Airflow to task sdk machinery.
got686-yandex pushed a commit to got686-yandex/airflow that referenced this pull request Jan 30, 2025
)

Ports the `execution_timeout` for tasks in legacy Airflow to task sdk machinery.
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.

Port task timeout over to task sdk

2 participants