Skip to content

Conversation

@Lee-W
Copy link
Member

@Lee-W Lee-W commented Jan 23, 2025

Why

We need to add support for inlet-events in task_sdk context as well.

What

  • move InletEventsAccessors from airflow/utils/context.py to task_sdk/src/airflow/sdk/execution_time/context.py
    • use SUPERVISOR_COMMS to retrieve asset events
  • add AssetEventResponse, DagRunAssetReference data models
  • add /asset-events route with
    • /by-asset-name-uri
    • /by-asset-uri
    • /by-asset-name
    • /by-alias-name
  • add AssetEventOperations to handle the routing
  • handle the new routes in task_sdk/src/airflow/sdk/execution_time/supervisor.py

closes: #45717
closes: #46852
closes: #46852


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

@Lee-W Lee-W force-pushed the add-asset-inlet-to-tasksdk branch from 3cb8fb4 to 6ac30c8 Compare February 4, 2025 10:07
@Lee-W Lee-W force-pushed the add-asset-inlet-to-tasksdk branch 3 times, most recently from 0c8da84 to 9460573 Compare February 17, 2025 13:40
@Lee-W Lee-W force-pushed the add-asset-inlet-to-tasksdk branch 4 times, most recently from a267114 to f613905 Compare February 18, 2025 10:27
@Lee-W
Copy link
Member Author

Lee-W commented Feb 18, 2025

Hey @ashb and @amoghrajesh , could you please take a quick look at this PR? in case I'm doing something wrong regarding task_sdk. The tests are not fixed as of now. I'll work on that if the overall logic looks ok. Thanks!

@Lee-W Lee-W self-assigned this Feb 19, 2025
Copy link
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

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

General direction looking good, will take a better look with tests.

@Lee-W
Copy link
Member Author

Lee-W commented Feb 19, 2025

Thanks @amoghrajesh !

@Lee-W Lee-W force-pushed the add-asset-inlet-to-tasksdk branch 15 times, most recently from b5fe1d2 to d07c722 Compare February 21, 2025 11:46
@Lee-W
Copy link
Member Author

Lee-W commented Feb 27, 2025

it's green after rerun 🙌

Copy link
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

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

Almost there. Preemptively approving provided my comments are handled.

@Lee-W Lee-W added the airflow3.0:breaking Candidates for Airflow 3.0 that contain breaking changes label Mar 3, 2025
@Lee-W Lee-W force-pushed the add-asset-inlet-to-tasksdk branch from cd49204 to 1cf88c4 Compare March 3, 2025 03:14
@Lee-W
Copy link
Member Author

Lee-W commented Mar 3, 2025

@amoghrajesh I'll merge it this afternoon. Please let me know if you want to take a look again 🙂

@Lee-W Lee-W merged commit ccd126f into apache:main Mar 3, 2025
61 checks passed
@Lee-W Lee-W deleted the add-asset-inlet-to-tasksdk branch March 3, 2025 06:45
shahar1 pushed a commit to shahar1/airflow that referenced this pull request Mar 5, 2025
…45960)

* feat(task_sdk): add support for inlet_events in Task Context

* feat(task_sdk): add AssetEventCollectionResponse

* refactor(task_sdk): combine asset event uris

* refactor(api_fastapi): extract asset_event datamodels from asset

* fix(task_sdk): revert unrelated datamodels change

* fix(task_sdk/context): add _get_asset_events_from_db for fixing tests

* test(task_sdk): add test cases for execution_time context inlet access

* test(task_sdk): extend test_handle_requests to include asset event calls

* test(execution_api): add tests to asset event apis

* fix(execution_api): remove unnecessary redact

* feat(task_sdk): extract asset response from asset event response

* feat(task_sdk): add missing http exception

* feat(task_sdk): extract asset response from asset event response

* feat(task_sdk): remove duplicate inlet logic

* feat(task_sdk): remove AssetEvent form definitions

* test(task_sdk): add test case test_run_with_asset_inlets

* docs(newsfragments): add description of how inlet_events access has been changed
nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Apr 4, 2025
…45960)

* feat(task_sdk): add support for inlet_events in Task Context

* feat(task_sdk): add AssetEventCollectionResponse

* refactor(task_sdk): combine asset event uris

* refactor(api_fastapi): extract asset_event datamodels from asset

* fix(task_sdk): revert unrelated datamodels change

* fix(task_sdk/context): add _get_asset_events_from_db for fixing tests

* test(task_sdk): add test cases for execution_time context inlet access

* test(task_sdk): extend test_handle_requests to include asset event calls

* test(execution_api): add tests to asset event apis

* fix(execution_api): remove unnecessary redact

* feat(task_sdk): extract asset response from asset event response

* feat(task_sdk): add missing http exception

* feat(task_sdk): extract asset response from asset event response

* feat(task_sdk): remove duplicate inlet logic

* feat(task_sdk): remove AssetEvent form definitions

* test(task_sdk): add test case test_run_with_asset_inlets

* docs(newsfragments): add description of how inlet_events access has been changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

airflow3.0:breaking Candidates for Airflow 3.0 that contain breaking changes area:task-sdk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Asset events are not getting created for subclasses Dataset and Model AIP-72: Allow retrieving Assets via API Server & Task Context

4 participants