potiuk commented on code in PR #41039: URL: https://github.com/apache/airflow/pull/41039#discussion_r1703370328
########## airflow/utils/python_virtualenv.py: ########## @@ -149,3 +157,76 @@ def write_python_script( ) template = template_env.get_template("python_virtualenv_script.jinja2") template.stream(**jinja_context).dump(filename) + + +def context_to_json(context: Context) -> str: Review Comment: I think we do not need to do it. We already handle context serialization and deserialization for the purpose of AIP-44 (and it got very well tested and fixed recently during #41067) https://github.com/apache/airflow/blob/main/airflow/serialization/serialized_objects.py#L798 So you generally need to do BasSerialization.serialize(context) and then BaseSerialization.deserialize(serialized_context). This has the added benefit that it will also restore some of the non-serializable parts of context: * Variable and Connection accessors * Macros And likely more if we find some other things. -- 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. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org