Skip to content

Start porting DAG definition code to the Task SDK - #43076

Merged
kaxil merged 32 commits into
mainfrom
task-sdk-first-code
Oct 30, 2024
Merged

kaxil merged 32 commits into
mainfrom
task-sdk-first-code

Conversation

@ashb

@ashb ashb commented Oct 16, 2024 •

Copy link
Copy Markdown
Member

By "definition code" we mean anything needed at definition/parse time, leaving
anything to do with scheduling time decisions in Airflow's core.

Also in this PR I have attempted to keep it to only porting defintiion code
for simple DAGs, leaving anything to do with mapped tasks or execution time in
core for now, but a few things "leaked" across.

And as the goal of this PR is to go from working state to working state some
of the code in Task SDK still imports from "core" (various types, enums or
helpers) that will need to be resolved before 3.0 release, but it is fine for
now.

I'm also aware that the class hierarchy with
airflow.models.baseoperator.BaseOperator (and to a lesser extend with DAG) in
particular is very messy right now, and we will need to think how we want to
add on the scheduling-time functions etc, as I'm not yet sold that having Core
Airflow depend upon the Task-SDK classes/import the code is the right
structure, but we can address that later

We will also need to addresses the rendered docs for the Task SDK in a future
PR -- the goal is that "anything" exposed on airflow.sdk directly is part of
the public API, but right now the renedered docs show DAG as
airflow.sdk.definitions.dag.DAG which is certainly not what we want users to
see.

closes #43011

@ashb

ashb commented Oct 16, 2024

Copy link
Copy Markdown
Member Author

This is very much at the "boring ground work stage" - once we've got this covered we can add some of the execution changes which is not of the n"execution interface" side where it gets fun

@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.

Some comments. In general looks great!

A bit of a challenge to review such a big PR - and I assume it is just the starting :-D - if possible would be cool to split this a bit up for better review, e.g.

  • One PR just the skeleton and AbstractOperator or so
  • One PR for BaseOperator
  • One PR for DAG only
  • Maybe one for Nodes/TaskGroup etc clubbing the rest together.

Anyway after some time was able to digest. Would offer also a full review if needed. And please don't take my early comments too serious more or less thinking out loud.

Comment thread airflow/models/dag.py Outdated
Comment thread airflow/task/priority_strategy.py
Comment thread task_sdk/src/airflow/sdk/__init__.py
Comment thread task_sdk/src/airflow/sdk/definitions/abstractoperator.py
Comment thread task_sdk/src/airflow/sdk/definitions/abstractoperator.py
Comment thread task_sdk/src/airflow/sdk/definitions/abstractoperator.py
Comment thread task_sdk/src/airflow/sdk/definitions/abstractoperator.py
Comment thread task_sdk/src/airflow/sdk/definitions/baseoperator.py
Comment thread task_sdk/src/airflow/sdk/exceptions.py
Comment thread uv.lock Outdated
Comment thread task_sdk/src/airflow/sdk/__init__.py Outdated
Comment thread task_sdk/src/airflow/sdk/definitions/abstractoperator.py
Comment thread task_sdk/src/airflow/sdk/definitions/abstractoperator.py Outdated
Comment thread task_sdk/src/airflow/sdk/definitions/abstractoperator.py
Comment thread task_sdk/src/airflow/sdk/definitions/abstractoperator.py
Comment thread task_sdk/src/airflow/sdk/definitions/baseoperator.py
Comment thread task_sdk/src/airflow/sdk/definitions/dag.py
Comment thread task_sdk/src/airflow/sdk/definitions/mixins.py Outdated
Comment thread uv.lock Outdated
Comment thread uv.lock Outdated
@ashb

ashb commented Oct 17, 2024

Copy link
Copy Markdown
Member Author

@kaxil @jscheffl I've just pushed latest changes to this. Probably not worth looking at it again until I've finished it and have a decent idea that the tests are passing locally, but in the last commit I've just pushed I have removed the old code I've ported over, so it might be slightly clearer where I've just moved code.

@ashb
ashb force-pushed the task-sdk-first-code branch from 2657f36 to 22566d8 Compare October 17, 2024 21:13
@ashb

This comment was marked as outdated.

@ashb
ashb force-pushed the task-sdk-first-code branch 3 times, most recently from c0a7b96 to fd1085d Compare October 22, 2024 14:42
@kaxil
kaxil force-pushed the task-sdk-first-code branch 5 times, most recently from 29f9cda to d4e015a Compare October 23, 2024 12:32
@ashb
ashb force-pushed the task-sdk-first-code branch from d4e015a to acdfa2c Compare October 24, 2024 12:19
Comment thread task_sdk/src/airflow/sdk/definitions/abstractoperator.py
Comment thread airflow/models/param.py
@kaxil
kaxil force-pushed the task-sdk-first-code branch from 5bb8796 to 2301523 Compare October 25, 2024 14:35
@ashb
ashb force-pushed the task-sdk-first-code branch 3 times, most recently from 03282b4 to 11e4304 Compare October 28, 2024 22:42
@ashb

This comment was marked as outdated.

@kaxil
kaxil force-pushed the task-sdk-first-code branch from c0d765b to 3acfb5c Compare October 29, 2024 12:42
kaxil added a commit to astronomer/airflow that referenced this pull request Oct 29, 2024
While debugging test failures on apache#43076, found that
this docstring was wrong, most likely a copy/paste error of `ti._handle_failure`
kaxil added a commit that referenced this pull request Oct 29, 2024
While debugging test failures on #43076, found that
this docstring was wrong, most likely a copy/paste error of `ti._handle_failure`
@ashb
ashb force-pushed the task-sdk-first-code branch from fc8645e to 6768541 Compare October 29, 2024 16:14
@ashb ashb added the legacy api Whether legacy API changes should be allowed in PR label Oct 29, 2024
ashb added 3 commits October 30, 2024 15:03
Since the scheduler needs it (at least for now), we need to ensure that we
include it in our prod-image builds in CI
@ashb
ashb force-pushed the task-sdk-first-code branch from a94684a to 1ef4b33 Compare October 30, 2024 16:20
Comment thread airflow/models/dag.py
@ashb

ashb commented Oct 30, 2024

Copy link
Copy Markdown
Member Author

There are lots more things to move over to the TaskSDK before AIP-72 will be complete which we will track in the project board, but since this is the big base, and slow to test due to unavoidable wide reaching changes we will merge this and follow up with future changes for the rest (things like Mapped operator, DagParam etc)

@kaxil
kaxil merged commit d8c7d28 into main Oct 30, 2024
@kaxil
kaxil deleted the task-sdk-first-code branch October 30, 2024 18:21
@kaxil

kaxil commented Oct 30, 2024 •

Copy link
Copy Markdown
Member

Merging this, one of the failures around k8s test that took longer than an hour looks like a transient one:

Progress: airflow-python-3.9-v1.28.13   Error during running tests for Python 3.9, Kubernetes v1.28.13
Progress: airflow-python-3.10-v1.29.8   Image: "ghcr.io/apache/airflow/main/prod/python3.10-kubernetes" with ID "sha256:1547fde10197845f0938fd7d0fc5977273a4871e016c8102ce9c8eb33010d064" not [...]

If for some reason it fails on main too, we will debug it

kaxil added a commit to astronomer/airflow that referenced this pull request Oct 30, 2024
Fixing one of the TODOs: apache#43076

This was already addressed.
kaxil added a commit that referenced this pull request Oct 30, 2024
Fixing one of the TODOs: #43076

This was already addressed.
ellisms pushed a commit to ellisms/airflow that referenced this pull request Nov 13, 2024
While debugging test failures on apache#43076, found that
this docstring was wrong, most likely a copy/paste error of `ti._handle_failure`
ellisms pushed a commit to ellisms/airflow that referenced this pull request Nov 13, 2024
closes apache#43011

By "definition code" we mean anything needed at definition/parse time, leaving
anything to do with scheduling time decisions in Airflow's core.

Also in this PR I have _attempted_ to keep it to only porting defintiion code
for simple DAGs, leaving anything to do with mapped tasks or execution time in
core for now, but a few things "leaked" across.

And as the goal of this PR is to go from working state to working state some
of the code in Task SDK still imports from "core" (various types, enums or
helpers) that will need to be resolved before 3.0 release, but it is fine for
now.

I'm also aware that the class hierarchy with
airflow.models.baseoperator.BaseOperator (and to a lesser extend with DAG) in
particular is very messy right now, and we will need to think how we want to
add on the scheduling-time functions etc, as I'm not yet sold that having Core
Airflow depend upon the Task-SDK classes/import the code is the right
structure, but we can address that later

We will also need to addresses the rendered docs for the Task SDK in a future
PR -- the goal is that "anything" exposed on `airflow.sdk` directly is part of
the public API, but right now the renedered docs show DAG as
`airflow.sdk.definitions.dag.DAG` which is certainly not what we want users to
see.

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
ellisms pushed a commit to ellisms/airflow that referenced this pull request Nov 13, 2024
Fixing one of the TODOs: apache#43076

This was already addressed.
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request May 27, 2025
While debugging test failures on apache/airflow#43076, found that
this docstring was wrong, most likely a copy/paste error of `ti._handle_failure`

GitOrigin-RevId: 755c10b99752b1868eb410a00563eff537300e91
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request May 27, 2025
Fixing one of the TODOs: apache/airflow#43076

This was already addressed.

GitOrigin-RevId: da265d92cad180e69541294cc7237493c8d9560a
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Sep 22, 2025
While debugging test failures on apache/airflow#43076, found that
this docstring was wrong, most likely a copy/paste error of `ti._handle_failure`

GitOrigin-RevId: 755c10b99752b1868eb410a00563eff537300e91
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Sep 23, 2025
Fixing one of the TODOs: apache/airflow#43076

This was already addressed.

GitOrigin-RevId: da265d92cad180e69541294cc7237493c8d9560a
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Oct 20, 2025
While debugging test failures on apache/airflow#43076, found that
this docstring was wrong, most likely a copy/paste error of `ti._handle_failure`

GitOrigin-RevId: 755c10b99752b1868eb410a00563eff537300e91
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Oct 20, 2025
Fixing one of the TODOs: apache/airflow#43076

This was already addressed.

GitOrigin-RevId: da265d92cad180e69541294cc7237493c8d9560a
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Feb 26, 2026
While debugging test failures on apache/airflow#43076, found that
this docstring was wrong, most likely a copy/paste error of `ti._handle_failure`

GitOrigin-RevId: 755c10b99752b1868eb410a00563eff537300e91
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Feb 26, 2026
Fixing one of the TODOs: apache/airflow#43076

This was already addressed.

GitOrigin-RevId: da265d92cad180e69541294cc7237493c8d9560a
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Jul 27, 2026
While debugging test failures on apache/airflow#43076, found that
this docstring was wrong, most likely a copy/paste error of `ti._handle_failure`

GitOrigin-RevId: 755c10b99752b1868eb410a00563eff537300e91
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Jul 27, 2026
Fixing one of the TODOs: apache/airflow#43076

This was already addressed.

GitOrigin-RevId: da265d92cad180e69541294cc7237493c8d9560a
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Jul 28, 2026
While debugging test failures on apache/airflow#43076, found that
this docstring was wrong, most likely a copy/paste error of `ti._handle_failure`

GitOrigin-RevId: 755c10b99752b1868eb410a00563eff537300e91
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Jul 28, 2026
Fixing one of the TODOs: apache/airflow#43076

This was already addressed.

GitOrigin-RevId: da265d92cad180e69541294cc7237493c8d9560a
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Sep 3, 2026
While debugging test failures on apache/airflow#43076, found that
this docstring was wrong, most likely a copy/paste error of `ti._handle_failure`

GitOrigin-RevId: 755c10b99752b1868eb410a00563eff537300e91
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Sep 3, 2026
Fixing one of the TODOs: apache/airflow#43076

This was already addressed.

GitOrigin-RevId: da265d92cad180e69541294cc7237493c8d9560a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:scheduler area:task-sdk legacy api Whether legacy API changes should be allowed in PR

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

Extract dag definition object models to Task SDK - Phase 1

6 participants