Add example for dynamically mapped tasks#24085
Conversation
|
One of the reasons I have not found the mapped task bug in the last rc1 is that I am usually using couple of example dags to test airflow. And surprisingly I found we had no dynamic mapped task in our "example_dags" :). Here is one I used to test rc2 |
|
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
1 similar comment
|
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
|
Seems like bitnami chart is failing more and more ... |
d1c03b0 to
4115244
Compare
|
Serialization error... |
|
This is strange :) |
|
Hey @uranusjr @ashb @kaxil - I need your expert knowledge here. It seems that - after I added "Mapped tasks" to example dags, the serialization test detected it as "wrong". I am not 100% sure what the implications are without deeper looking at it but it does look like we are not able to use Mapped Tasks in cases where Dags are serialized - which might or might not be a problem. Example here: https://github.com/apache/airflow/runs/6710772433?check_suite_focus=true#step:10:4202 Any comments before I dive deeper to understand it ? |
|
Looks like the test is wrong. MappedOperator instances are deserialised into MappedOperator, not SerializedBaseOperator. The test should be updated to if serialized_task.is_mapped:
assert isinstance(serialized_task, MappedOperator)
assert isinstance(task, MappedOperator)
else:
assert isinstance(serialized_task, SerializedBaseOperator)
assert isinstance(task, BaseOperator)
assert not isinstance(task, SerializedBaseOperator) |
|
Thanks @uranusjr ! |
This change adds quite a bit of modifications in the mapped operators implementation to make them comparable before and after serialization as otherwise the serialization tests fail.
4115244 to
508f1da
Compare
|
Hey @uranusjr - actually I needed to do quite a number of other changes to make the tests pass. I am not sure however if some of those changes are how they should be - some of them were based rather on intuition than facts as the current hierarchy of operators and how it interacts with Serialization is well,, convoluted to say the least (most of it obviously due to history of adding MappedOperator on top of existing BaseOperator).
For dags: |
|
I'd appreciate thorough review :) |
|
For some strange reason DecoratedMappedOperator is not hashable however it should (in principle) derive hash() and eq() from MappedOperator. Anyone knows what's going on here :)? Some Python woodo we do somewhere? |
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 newsfragement file, named
{pr_number}.significant.rst, in newsfragments.