-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Airflow 3.0 deprecations #14626
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
Comments
There's already a short proposal #14616 (comment). Putting it here might make it easier to find 🙂 I'm thinking of separating "removal" and "rename" at least. It would be much easier for the users to know whether there's anything they could do to fix it. |
Additionally, the NumPy 2.0 migration rule is a good reference whose implementation is at: https://github.com/astral-sh/ruff/blob/6f1cf5b686e67fb74383641fcbbe98e33481a271/crates/ruff_linter/src/rules/numpy/rules/numpy_2_0_deprecation.rs |
Hi, we have grouped our deprecations into several categories and would appreciate it if the team could take a look and let us know what you think about it 🙂
Here's the categorised list we have now |
I like what's proposed here. Thanks for going through all the deprecations and grouping them by possible rules. We can also do some fine-tuning as we go. |
Later discuss with @uranusjr, we think it would be better for us to merge rename and removal into
We now use apache/airflow#44556 to track the detail of this task instead of the original one as some of the migration might not be able to be done in ruff |
Sorry for pinging you here, but could someone more familiar with Airflow volunteer looking at the changes in #14631? We just want to make sure that the change is correct. |
Looks like a valid one to me |
Thanks for taking a look! |
I think it'll also be really useful to provide an auto-fix for these rules. Refer to how NumPy 2.0 deprecation rule does it: ruff/crates/ruff_linter/src/rules/numpy/rules/numpy_2_0_deprecation.rs Lines 683 to 708 in 1bd8fbb
And, I think we'll also need to add this guard check specific to Airflow imports and attributes which allows for having both the new and deprecated symbols to exists in a ruff/crates/ruff_linter/src/rules/numpy/rules/numpy_2_0_deprecation.rs Lines 671 to 673 in 1bd8fbb
|
I agree. We’re on a tight schedule and would like to prioritise adding all the rules first, but contribution is always welcomed on these. |
Yeah, I think that's fine. Do you have a rough timeline on when v3 is going to be released? I could spend some time in adding the infrastructure for an auto-fix. I think that shouldn't take much time as we already have a reference implementation. And, I'll mark this as a "help wanted" task in the issue description if someone else is interested. |
It seems ruff also has interface to add fixes which seems straightforward. I tested below where users can opt for unsafe fixes using Diff : main...tirkarthi:ruff:air302-fixes
|
@tirkarthi Thank you for working on that. I think it will be useful to consider the kind of deprecations and provide the auto-fixes accordingly. Your implementation looks simple enough, I'm happy to look at the PR. One suggestion for the |
Thanks @dhruvmanila, created PR #14887 . I agree that the fixes need to be categorized like numpy with |
Just created a new one for AIR303 #14764 |
Is there a helper method to change the import path while keeping the symbol name? I looked at numpy replacements and they seem to do something like below where the import path remains the same and new symbol is introduced. In terms of Airflow deprecations the symbol remains the same but import path changes. Just changing the import path of the replacement through from airflow.operators.empty import EmptyOperator
from airflow.providers.standard.operators.empty import EmptyOperator Deprecated from numpy import all Fix from numpy import all, alltrue Deprecated and removed that will cause from airflow.operators.empty import EmptyOperator Fix from airflow.providers.standard.operators.empty import EmptyOperator |
I don't think we'll add new things to AIR301, but there're still some for AIR302 and AIR303 that we're currently out of bandwidth to work on |
so probably keep all of them as preview for now would be better I think |
Sounds reasonable. Thanks for the update. |
Hey @dhruvmanila @MichaReiser, Recently, we've been testing these Original
Proposal
For those who want to migrate to Airflow 3.0, |
Yes, I think it would lead to less confusion.
This is also one thing I think might work. Maybe regroup it to something like the following?
|
Apart from this discussion, if you still have some bandwidth. It would be much appreciated if we can have these PRs reviewed 🙂 .
|
Yes, I also think the same.
Right, so is my understanding correct (?) that there are now two groups:
Can you tell me the difference between I think the overall grouping makes sense. I'll start reviewing the linked PRs. |
@Lee-W Can you help me in what order should I be reviewing the PRs? Do you want to regroup the rules first? Does that require changing some of the symbols that are currently being detected as hard deprecation but need to be moved to soft deprecations? Regardless, I'm going to review the PRs that you've opened as they seem to only implement the autofix for the rules. |
Yes, this understanding is correct!
AIR302 (original 303) is something like |
The regrouped has not yet been created (except for 301 to 002). Others are auto fix PRs. But after addressing all the comments on current PRs, I'll list them down here again. Thanks!
I'll create PRs today or tomorrow. We can look into the autofix first.
Yes, it will. |
Hey @dhruvmanila , would like to update the PR orders a bit. Many thanks! We still need some more feedback on #16965 first. The following 4 are easier to review.
One missing piece found in #17115 and then #17123 which reflects the latest Airflow 3.0 changes and depends on the previous PR. the reorg has not yet been started. all the PR above still follows the current error code design as #16978 is still under review. |
Thank you, just acknowledging this. I've added this to my todo list for today, I'll start looking into it in a couple of hours. |
Much appreciated! 🙏 |
Hey @dhruvmanila , just a heads up. @sunank200 will help with the reorg and apply the autofix to other rules for the following few days. I'll be back next Monday. I'll send a sample reorg PR later today (branched out from #16978) so it would be easier for @sunank200 to pick up. Thanks for helping out! |
## Summary Following up the discussion in #14626 (comment), we're to reorganize airflow rules. Before this discussion happens, we combine required changes and suggested changes in to one single error code. This PR first rename the original error code to the new error code as we discussed. We will gradually extract suggested changes out of AIR301 and AIR302 to AIR311 and AIR312 in the following PRs ## Test Plan Except for file, error code rename, the test case should work as it used to be.
@dhruvmanila Thanks so so so much for helping out and merging so many PRs! @sunank200 As I'm out till next Monday, here are things we can do as the next steps. Fix and adding rules
Autofix
Reorg
|
Just a heads up, @ntBre is going to be taking over looking at the remaining parts of the Airflow work. Feel free to tag me if there's anything specific that requires my input / context. |
…l-sh#17151) ## Summary Following up the discussion in astral-sh#14626 (comment), we're to reorganize airflow rules. Before this discussion happens, we combine required changes and suggested changes in to one single error code. This PR first rename the original error code to the new error code as we discussed. We will gradually extract suggested changes out of AIR301 and AIR302 to AIR311 and AIR312 in the following PRs ## Test Plan Except for file, error code rename, the test case should work as it used to be.
Hey @ntBre , just try to list down what we have now so it would be easier for you to track 🙂
|
Thanks for the list! I approved 1-3 with very minor comments, and I'll try to tackle 4 this evening or tomorrow morning. |
…#17152) <!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> As discussed in #14626 (comment), we're to separate suggested changes from required changes. The following symbols has been moved to AIR312 from AIR302. They still work in Airflow 3.0, but they're suggested to be changed as they're expected to be removed in future version ```python from airflow.hooks.filesystem import FSHook from airflow.hooks.package_index import PackageIndexHook from airflow.hooks.subprocess import (SubprocessHook, SubprocessResult, working_directory) from airflow.operators.bash import BashOperator from airflow.operators.datetime import BranchDateTimeOperator, target_times_as_dates from airflow.operators.trigger_dagrun import TriggerDagRunLink, TriggerDagRunOperator from airflow.operators.empty import EmptyOperator from airflow.operators.latest_only import LatestOnlyOperator from airflow.operators.python import (BranchPythonOperator, PythonOperator, PythonVirtualenvOperator, ShortCircuitOperator) from airflow.operators.weekday import BranchDayOfWeekOperator from airflow.sensors.date_time import DateTimeSensor, DateTimeSensorAsync from airflow.sensors.external_task import ExternalTaskMarker, ExternalTaskSensor, ExternalTaskSensorLink from airflow.sensors.filesystem import FileSensor from airflow.sensors.time_sensor import TimeSensor, TimeSensorAsync from airflow.sensors.time_delta import TimeDeltaSensor, TimeDeltaSensorAsync, WaitSensor from airflow.sensors.weekday import DayOfWeekSensor from airflow.triggers.external_task import DagStateTrigger, WorkflowTrigger from airflow.triggers.file import FileTrigger from airflow.triggers.temporal import DateTimeTrigger, TimeDeltaTrigger ``` ## Test Plan <!-- How was it tested? --> The test fixture has been updated acccordingly --------- Co-authored-by: Brent Westbrook <[email protected]>
…astral-sh#17152) <!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> As discussed in astral-sh#14626 (comment), we're to separate suggested changes from required changes. The following symbols has been moved to AIR312 from AIR302. They still work in Airflow 3.0, but they're suggested to be changed as they're expected to be removed in future version ```python from airflow.hooks.filesystem import FSHook from airflow.hooks.package_index import PackageIndexHook from airflow.hooks.subprocess import (SubprocessHook, SubprocessResult, working_directory) from airflow.operators.bash import BashOperator from airflow.operators.datetime import BranchDateTimeOperator, target_times_as_dates from airflow.operators.trigger_dagrun import TriggerDagRunLink, TriggerDagRunOperator from airflow.operators.empty import EmptyOperator from airflow.operators.latest_only import LatestOnlyOperator from airflow.operators.python import (BranchPythonOperator, PythonOperator, PythonVirtualenvOperator, ShortCircuitOperator) from airflow.operators.weekday import BranchDayOfWeekOperator from airflow.sensors.date_time import DateTimeSensor, DateTimeSensorAsync from airflow.sensors.external_task import ExternalTaskMarker, ExternalTaskSensor, ExternalTaskSensorLink from airflow.sensors.filesystem import FileSensor from airflow.sensors.time_sensor import TimeSensor, TimeSensorAsync from airflow.sensors.time_delta import TimeDeltaSensor, TimeDeltaSensorAsync, WaitSensor from airflow.sensors.weekday import DayOfWeekSensor from airflow.triggers.external_task import DagStateTrigger, WorkflowTrigger from airflow.triggers.file import FileTrigger from airflow.triggers.temporal import DateTimeTrigger, TimeDeltaTrigger ``` ## Test Plan <!-- How was it tested? --> The test fixture has been updated acccordingly --------- Co-authored-by: Brent Westbrook <[email protected]>
Hey @ntBre , I'll try to use this issue to communicate if there's more than one PR that needs your help, so that you won't need to switch between PRs. 🙂
It would be really nice if we could have them in 0.11.6 🙂 I'll other autofixes things once I'm back next week. |
I'll review these today! |
…#17310) <!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> As discussed in #14626 (comment), we're to separate suggested changes from required changes. The following symbols have been moved to AIR311 from AIR301. They still work in Airflow 3.0, but they're suggested to be changed as they're expected to be removed in a future version. * arguments * `airflow..DAG | dag` * `sla_miss_callback` * operators * `sla` * name * `airflow.Dataset] | [airflow.datasets.Dataset` → `airflow.sdk.Asset` * `airflow.datasets, rest @ ..` * `DatasetAlias` → `airflow.sdk.AssetAlias` * `DatasetAll` → `airflow.sdk.AssetAll` * `DatasetAny` → `airflow.sdk.AssetAny` * `expand_alias_to_datasets` → `airflow.sdk.expand_alias_to_assets` * `metadata.Metadata` → `airflow.sdk.Metadata` <!--airflow.models.baseoperator--> * `airflow.models.baseoperator.chain` → `airflow.sdk.chain` * `airflow.models.baseoperator.chain_linear` → `airflow.sdk.chain_linear` * `airflow.models.baseoperator.cross_downstream` → `airflow.sdk.cross_downstream` * `airflow.models.baseoperatorlink.BaseOperatorLink` → `airflow.sdk.definitions.baseoperatorlink.BaseOperatorLink` * `airflow.timetables, rest @ ..` * `datasets.DatasetOrTimeSchedule` → * `airflow.timetables.assets.AssetOrTimeSchedule` * `airflow.utils, rest @ ..` <!--airflow.utils.dag_parsing_context--> * `dag_parsing_context.get_parsing_context` → `airflow.sdk.get_parsing_context` ## Test Plan <!-- How was it tested? --> The test fixture has been updated acccordingly
Hey @ntBre , Just a quick update on the PRs I have today |
Hey @ntBre , Another quick update on the PRs we need your help 🙂 |
Thanks for these lists! I reviewed the top-level PRs and can move on to the next layer soon. |
Hey @ntBre , Another quick up on the PRs we have now 🙂 |
Tracking issue for the
AIR3xx
rules that implements Airflow 3.0 deprecations.For details, refer to the Airflow tracking issue: apache/airflow#44556
Help wanted
The following is a "help wanted" task list:
try .. except
block could include both the new and deprecated symbols for backwards compatibility. Look at NumPy 2.0 implementation for referenceRef: apache/airflow#41641
The text was updated successfully, but these errors were encountered: