-
Notifications
You must be signed in to change notification settings - Fork 43
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
Allow installing Python SDK without enabling pickling #997
Conversation
This PR reverts #446 . Without this, users can not even run Airflow if Astro SDK is installed. This will even allow users to use `File` and `Table` objects in `inlets` and `outlets` without using any operators or decorators. This will also allow us to install SDK in Runtime image without impacting users who don't want to use SDK
Codecov ReportBase: 94.46% // Head: 94.45% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #997 +/- ##
==========================================
- Coverage 94.46% 94.45% -0.01%
==========================================
Files 47 47
Lines 2113 2110 -3
Branches 229 228 -1
==========================================
- Hits 1996 1993 -3
Misses 83 83
Partials 34 34
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
||
|
||
if not conf.getboolean(section="core", key="enable_xcom_pickling"): | ||
raise OSError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaxil, what if we didn't raise an OSError
but had a warning alerting users that some features may not work if enable_xcom_pickling
is False? (e.g. aql.dataframe
)? It can be misleading to not have any warning, and several features do not work.
I understand the motivation in allowing users to install and use the parts worth it without pickling - but, still, it's better to have a warning (at the very list on the tasks/decorators which will not work, such as aql.dataframe
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aql.dataframe
has a check before pushing to XCom though:
astro-sdk/python-sdk/src/astro/sql/operators/dataframe.py
Lines 166 to 171 in b9c974e
else: | |
if ( | |
not settings.IS_CUSTOM_XCOM_BACKEND | |
and not settings.ALLOW_UNSAFE_DF_STORAGE | |
): | |
raise IllegalLoadToDatabaseException() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where would you like me to add the warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tatiana I merged it since the error message from Airflow contains useful message as below but do let me know if you would like me to add any warning, happy to do that in a separate PR
Could not serialize the XCom value into JSON. If you are using pickle instead of JSON for XCom, then you need to enable pickle support for XCom in your *** config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current exception looks sufficient to me:
Could not serialize the XCom value into JSON. If you are using pickle instead of JSON for XCom, then you need to enable pickle support for XCom in your *** config.
Description
What is the current behavior?
Users can not even run Airflow if Astro SDK is installed but if they don't want to run it. For example, we can't install Astro SDK in the runtime image.
What is the new behavior?
This PR reverts #446 . Without this, users can not even run Airflow if Astro SDK is installed.
This will even allow users to use
File
andTable
objects ininlets
andoutlets
without using any operators or decorators.This will also allow us to install SDK in Runtime image without impacting users who don't want to use SDK
The only caveat if users don't enable XCom pickling, the following error is raised but that is OK. We would like to get this in Astro SDK 1.2 (or 1.1.2) as we plan to tackle removal of pickling completely in #795:
This will allow users to use the following without pickling:
This works because of apache/airflow@25a1a1b which we added in 2.4.0
Does this introduce a breaking change?
No
Checklist