Apache Airflow version
main (development)
What happened
if using the TaskFlow API and one does the following
@task()
def MyFunc(myarg: int) -> dict:
return dict({x: "y", z: "x"})
Airflow automatically unwinds dict automatically into separate variables x and z and if you do not want that kind of bahavior you will need to set multiple_outputs=False. While this is in the documentation, it is rather non intuitive requiring someone to be aware of the documentation that the default of multiple_outputs changes depending the return type of your function. Moreover, it is unexpected behavior for people coming from plain python (e.g. someone converting their functions to Airflow tasks) and wanting to do:
@task()
def f1(myarg: int) -> dict:
return dict({x: myarg, z: "x"})
@task
def f2(in: dict):
print(in)
a = f1(10)
f2(a)
Which would suddenly have issues in unittesting.
cc @josh-fell @BasPH @uranusjr
What you think should happen instead
Airflow should only unwind dicts if explicitly asked to do so.
How to reproduce
No response
Operating System
Not relevant
Versions of Apache Airflow Providers
No response
Deployment
Docker-Compose
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct
Apache Airflow version
main (development)
What happened
if using the TaskFlow API and one does the following
Airflow automatically unwinds
dictautomatically into separate variablesxandzand if you do not want that kind of bahavior you will need to setmultiple_outputs=False. While this is in the documentation, it is rather non intuitive requiring someone to be aware of the documentation that thedefaultofmultiple_outputschanges depending the return type of your function. Moreover, it is unexpected behavior for people coming from plain python (e.g. someone converting their functions to Airflow tasks) and wanting to do:Which would suddenly have issues in unittesting.
cc @josh-fell @BasPH @uranusjr
What you think should happen instead
Airflow should only unwind dicts if explicitly asked to do so.
How to reproduce
No response
Operating System
Not relevant
Versions of Apache Airflow Providers
No response
Deployment
Docker-Compose
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct