Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcom view broken for non-JSON values #42117

Open
1 of 2 tasks
jkramer-ginkgo opened this issue Sep 9, 2024 · 4 comments · May be fixed by #42388
Open
1 of 2 tasks

Xcom view broken for non-JSON values #42117

jkramer-ginkgo opened this issue Sep 9, 2024 · 4 comments · May be fixed by #42388
Labels
area:core area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues kind:bug This is a clearly a bug

Comments

@jkramer-ginkgo
Copy link
Contributor

Apache Airflow version

Other Airflow 2 version (please specify below)

If "Other Airflow 2 version" selected, which one?

2.10.1

What happened?

Non-JSON values are broken in the Xcom UI [screenshot attached]

Root cause is this line from #40640. Setting stringify: false results in JSON encoding which results in TypeError: keys must be str, int, float, bool or None, not tuple exception from GET <Airflow URL>/api/v1/dags/<DAG>/dagRuns/<Run ID>/taskInstances/<Task ID>/xcomEntries/<Xcom name>?stringify=false endpoint.

The PR's intention is to make the whole view JSON, so not sure if the intention is to error on non-JSON Xcom values, or if it should be updated to have clean fallback logic.

Pasted Graphic 22

[This is a dupe of #41981]

What you think should happen instead?

No response

How to reproduce

Create Xcom value that is non-JSON serializable (e.g. {('201009_NB502104_0421_AHJY23BGXG (SEQ_WF: 138898)', None): 82359}) and then try to view in UI Xcom tab

Operating System

Linux (Ubuntu 22.04)

Versions of Apache Airflow Providers

No response

Deployment

Virtualenv installation

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@jkramer-ginkgo jkramer-ginkgo added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Sep 9, 2024
@dosubot dosubot bot added the area:UI Related to UI/UX. For Frontend Developers. label Sep 9, 2024
@jscheffl
Copy link
Contributor

I tried to reproduce this if it is fixed with another fix I did in 2.10.2(rc1) but failed creating the XCom.
When using in code:

ti.xcom_push("non_json", {('201009_NB502104_0421_AHJY23BGXG (SEQ_WF: 138898)', None): 82359})

I get the error TypeError: keys must be str, int, float, bool or None, not tuple already during task execution,

How did you generate the data or can you please paste a piece of the example how you generated it?
Or even better, can you check if 2.10.2rc1 is fixing it already?

@jkramer-ginkgo
Copy link
Contributor Author

Maybe there's some diff between our configs and/or DAG-style but this xcom is properly being set and used. The dag is set up using PythonOperators and chain()s for dependency management.

[example]

context["ti"].xcom_push(
    key="key", value={('201009_NB502104_0421_AHJY23BGXG (SEQ_WF: 138898)', None): 82359}
)

@jkramer-ginkgo
Copy link
Contributor Author

Yes, we have enable_xcom_pickling = True set. As this is a supported config, it would imply non-JSON serializable Xcom values should be supported in the UI.

@jscheffl
Copy link
Contributor

Oh yeah. With AIRFLOW__CORE__ENABLE_XCOM_PICKLING=True this is a problem. Probably I/we did not consider this when updating the UI. This is (now) clearly a bug.

@jscheffl jscheffl added area:webserver Webserver related Issues and removed pending-response needs-triage label for new issues that we didn't triage yet labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues kind:bug This is a clearly a bug
Projects
None yet
2 participants