phi-friday commented on code in PR #41039:
URL: https://github.com/apache/airflow/pull/41039#discussion_r1703508029


##########
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:
   It certainly seems like using `BasSerialization` would be more effective.
   
   However, I have one question.
   For a `datetime` object, if I use `BasSerialization`, it will be serialized 
like this
   ```python
   {<Encoding.VAR: '__var'>: 1704067200.0,
    <Encoding.TYPE: '__type'>: <DagAttributeTypes.DATETIME: 'datetime'>}
   ```
   This seems to be a more user-unfriendly form than 
`'2024-01-01T00:00:00+00:00'`.
   
   Since this is more consistent and efficient, should I keep it?
   (This is a common problem for other objects that use 
`BaseSerialization._encode()` as well).
   
   I'm passing it as a dictionary object, not a model defined by Airflow, so I 
guess it doesn't matter...
   I'm not sure how to decide.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to