Skip to content

Conversation

@turbaszek
Copy link
Member

lshift and rshift methods should return other not self.
This PR fixes XComArg implementation to support chain like this one:
BaseOprator >> XComArg >> BaseOperator

Related to: #10153

Kudos to @yuqian90 for spotting this issue! 🚀

Screenshot 2020-09-09 at 12 57 21

I --- **^ 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 UPDATING.md.

@turbaszek turbaszek added the AIP-31 Task Flow API for nicer DAG definition label Sep 9, 2020
@turbaszek turbaszek requested a review from kaxil September 9, 2020 10:58
@turbaszek
Copy link
Member Author

@casassg would like to take a look?

Copy link
Member

@kaxil kaxil left a comment

Choose a reason for hiding this comment

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

Good spot @yuqian90 , thanks for the fix @turbaszek

Copy link
Contributor

@yuqian90 yuqian90 left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix. One other issue was that

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the quick fix. One other issue is that if we do this at this line:

xcom_args_a >> bash_op1 >>  xcom_args_b

Is this supposed to work? i have not tried yet, but looking at the code, I think BaseOperator.__rshift__ will complain that it can't handle xcom_args. That's a different issue though so the fix can be done separately.

Copy link
Member Author

Choose a reason for hiding this comment

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

Same DAG is used in tests to make sure that it works. BaseOperator._set_relatives handles XComArgs properly. However, XComArgs is missing in type hints due to cyclic imports. I think that once we have your PR merged we may consider something like TaskType that will be union of types that are "task-like"

Copy link
Contributor

@casassg casassg left a comment

Choose a reason for hiding this comment

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

__lshift__ and __rshift__ methods should return other not self.
This PR fixes XComArg implementation  to support chain like this one:
BaseOprator >> XComArg >> BaseOperator

Related to: apache#10153
@turbaszek turbaszek force-pushed the fix-chain-for-xcom-args branch from a014f5b to 6462c29 Compare September 14, 2020 08:33
@turbaszek
Copy link
Member Author

@casassg @yuqian90 I've added missing method. I'm wondering about making BaseTaskOperation class that will implement all those methods so we can use it in XComArg, BaseOperator and TaskGroup WDYT? @ashb @dimberman @potiuk

@ashb
Copy link
Member

ashb commented Sep 14, 2020

@casassg @yuqian90 I've added missing method. I'm wondering about making BaseTaskOperation class that will implement all those methods so we can use it in XComArg, BaseOperator and TaskGroup WDYT? @ashb @dimberman @potiuk

Sounds like a prime use of a mixin to me, rather than a base class. But some DRYing here now we have it three places definitely sounds good.

@turbaszek turbaszek mentioned this pull request Sep 14, 2020
@turbaszek turbaszek merged commit eaa49b2 into apache:master Sep 14, 2020
@turbaszek turbaszek deleted the fix-chain-for-xcom-args branch September 14, 2020 11:13
yuqian90 added a commit to yuqian90/airflow that referenced this pull request Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIP-31 Task Flow API for nicer DAG definition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants