You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/05/28 14:53:31 UTC

[GitHub] [airflow] ashb commented on pull request #8805: Resolve upstream tasks when template field is XComArg

ashb commented on pull request #8805:
URL: https://github.com/apache/airflow/pull/8805#issuecomment-635400916


   > ```python
   > with DAG(dag_id='xcomargs_test_3', default_args={"start_date": datetime.today()}) as dag3:
   >     op1 = DummyOperator(task_id="op1")
   >     op2 = CustomOp(task_id="op2", field=op1.output)
   > 
   > assert op1 in op2.upstream_list. # False
   > ```
   
   :interrobang:
   
   Fixing that usecase is like 90% of the case I would want to fix with this PR.
   
   Could we use the `__exit__` from the dag to fix this one case (but there are others that wouldn't be caught by that. 
   
   Given how rare metaprogramming is in Python, I think the metaclass approach gives a more complete solution, it catches all possible ways of assigning deps between a DAG.
   
   Yes, this is technically a breaking change, but I think it will affect almost no one. And I think the only "break" would be that using XComArg wouldn't work with a custom operator, unless your metaclass inherits this new metaclass. Is that correct? (i.e. the dag would still run, the user's metaclass would be the one that is used.)
   
   So I'm +1 for metaclass, if I've understood it all correctly.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org