ecerulm commented on issue #14598: URL: https://github.com/apache/airflow/issues/14598#issuecomment-790965006
I must confess that I didn't know about [Airflow 2.0: DAG Authoring Redesigned](https://medium.com/apache-airflow/airflow-2-0-dag-authoring-redesigned-651edc397178) and that it has been eye opening. So I guess the approach in 2.x to pass data from one task/operator A to another task/operator B is: * Return a value from the operator/task A. Operators have output(s) (for example you could return a pandas's DataFrame from PythonOperator) * operator/task B can declare that they take some other operator/task B output as input with `op_args=(taskA.output,)` * You provide an XComBackend that ** when task A returns a value takes care serializes it to a file, store in S3/etc, and then replaces the value that stored in XCom (which still has a limit of 48K) as maybe a string "pandasdf-s3://xxxx/mydata.parquet" and that is what really get stored in postgres and passed around by airflow ** when task B inputs are read (the value would be "pandas-df s3://xxx/mydate.parquet" the xcom backed will fetch the file from s3, deserialize into a pandas dataframe and pass that to the operator. So I don't see any problem with that,but from the links that @kaxil posted I believe there no interest for a generic implementation XComBackend for S3, etc to be maintained in the airflow project, because since tasks returns arbitrary python objects there is no generic efficient way to serialize them, for example if the task return a pandas's DataFrame you don't want to use pickle to serialize you want to use `df.to_parquet(...)` instead. So this feature request probably should be close but I think there are some follow up feature request that we can further discuss: * Maybe a another issue that advocates for creating a S3XComBackendBase that serve as a base to implement custom xcom backends just by providing the serialization logic. As I think part of the problem is that the serialize and the remote storage is conflated. * maybe the possibility of even providing an XComBackend per DAG , or at least a serializer per DAG, so that the guy authoring the DAG can decide the best way of serializing each type of value so @kaxil where is the best place to continue the discussion, in the mailing list or here? ---------------------------------------------------------------- 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: [email protected]
