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

Add DatasetAlias to support dynamic Dataset Event Emission and Dataset Creation #40478

Merged
merged 51 commits into from
Jul 15, 2024

Conversation

Lee-W
Copy link
Member

@Lee-W Lee-W commented Jun 28, 2024

Why this change?

related: #40039 which is inspired #34206

We want to allow DatasetEvent and Dataset to be created in a task dynamically.

e.g.,

@task(outlets=[DatasetAlias("my-task-outputs")])
def my_task(*, ds, outlet_events):
    outlet_events["my-task-outputs"].add(Dataset(f"s3://bucket/my-task/{ds}"))

What's change?

Introduced DatasetAlias which support the following syntax to create a Dataset and a DatasetEvent dynamically

@task(outlets=[DatasetAlias("my-task-outputs")])
def my_task_with_outlet_events(*, ds, outlet_events):
    outlet_events["my-task-outputs"].add(Dataset(f"s3://bucket/my-task/{ds}"))

@task(outlets=[DatasetAlias("my-task-outputs")])
def my_task_with_metadata(*, ds):
    s3_dataset = Dataset(f"s3://bucket/my-task/{ds}")
    yield Metadata(s3_dataset, extra={"k": "v"}, alias="my-task-outputs")

Note

This PR only supports part of the #40039. It does not yet support scheduling based on DatasetAlias (will create another PR for that)


^ 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
Copy link
Member Author

Lee-W commented Jul 6, 2024

Finally get the CI green. Will continue work on adding unit tests and docs

@Lee-W Lee-W force-pushed the dataset-alias branch 2 times, most recently from 617eb98 to 43b7673 Compare July 8, 2024 06:18
@Lee-W Lee-W force-pushed the dataset-alias branch 3 times, most recently from 3855047 to 9a8b71c Compare July 8, 2024 11:25
@Lee-W
Copy link
Member Author

Lee-W commented Jul 8, 2024

Added test cases to cover the changes. Will work on the documentation next

@Lee-W Lee-W changed the title Dataset alias Add DatasetAlias to support dynamic Dataset definition Jul 9, 2024
@Lee-W Lee-W marked this pull request as ready for review July 9, 2024 03:15
Lee-W and others added 24 commits July 13, 2024 10:54
Co-authored-by: Tzu-ping Chung <[email protected]>
@Lee-W Lee-W merged commit 3805050 into apache:main Jul 15, 2024
52 checks passed
@Lee-W Lee-W deleted the dataset-alias branch July 15, 2024 00:56
@Lee-W Lee-W mentioned this pull request Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants