dstandish commented on PR #32053: URL: https://github.com/apache/airflow/pull/32053#issuecomment-1602898460
> Here is why: > > ``` > # makes sense, s1/t1 wrap w1 > s1.as_setup() >> w1 >> t1.as_teardown(s1) > > # later in the file... > s1 >> w2 >> t1 > ``` > > Should I `s1.as_setup()` again? If I don't, what happens when I remove the original w1 lines `as_setup`? Keeping it during task instantiation avoids this problem. I don't find the "easier to convert" thing to be that big of a deal. Taskflow reuse is a valid concern though, but having a setup and non-setup share implementation isn't that difficult to pull off. Re "should I..."... No need to do this of course, since we already set the property on the object. And yes if you change the code, you change the behavior :) I think the same argument applies with class method really: "What happens if I remove the as_setup". I.e., I am not sure I see how the concern is materially different based on whether the property is set at instantiation or after. But, being able to set it after allows for this added convenience. I would moreover say that when we call `t.as_teardown(my_task)` that we should mark my_task as a setup too. I am not seeing any reason not to. This adds a lot of convenince and reduces boilerplate. Then in one line you have things configured. ``` my_s >> my_w >> my_t.as_teardown(my_s) ``` No other changes to the dag required. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
