Replies: 2 comments 6 replies
-
I do not think this is needed. If you want to pull XCom values in your KPO (or Docker operator) you can use the image with airflow to the Pod and you could simply run (providing the environment variables are passed):
Where `ti_key' is the compound key of what you want to pull. This will even make the values lazy - so if you are using Custom XCom backend, you will ony retrieve the value when you use it. We even have a chapter in our docs describing how you can check if XCom is correctly initialized in the container you run: |
Beta Was this translation helpful? Give feedback.
-
I am not sure how to read Xcom embedded in the image, is there an example of that somewhere? Is the method you are suggesting still employing passing the actual XCom through env vars? Passing large ( >600 kB ) environment variables make K8s raise an exception |
Beta Was this translation helpful? Give feedback.
-
I recently came across a limitation where I need to pull an XCom result (a JSON string) into a
KubernetesPodOperator
task. The final goal is to be able to serialize this result into the EFS volume the pod has mounted. Then I can use that file in downstream tasks.My only way of interacting with the XCom as of now is to use a Jinja template and have it render at runtime in the pod terminal:
When the contents of the XCom become large enough, the terminal command hits the OS character limit. My workaround right now is to push the file into some temporary network storage (i.e. S3), pass the URI into XCom, then use the URI to download the file into the pod. Obviously, this is not an ideal solution.
I was thinking that this can be done in a better way: introduce a new feature symmetric to the
return.json
concept, but for pulling XComs. E.g. introducing an argumentdo_xcom_pull_ids
in theKubernetesPodOperator
constructor, which specify which upstream XComs to make available inside the sidecar container, then serialize those files during setup so that they are available as e.g.task_id_X.json
,task_id_Y.json
, etc. for the user to pull.If you also think this is a feature worth introducing, I'd be happy to give a it a go.
Beta Was this translation helpful? Give feedback.
All reactions