antoinetavant opened a new pull request, #39620:
URL: https://github.com/apache/airflow/pull/39620

   Closes #39319 
   
   This PR provide two minor changes :
   - Two additional arguments are given to the python command to match the 
updates of the script interface
      `python3 /tmp/script.py /tmp/script.in /tmp/script.out none 
/tmp/script.out`
      Indeed, the script used in the DockerOperator in the same as the one in 
PythonVirtualenvOperator (see 
[airflow/utils/python_virtualenv_script.jinja2](https://github.com/karunpoudel/airflow/blob/1e75b694848b1eac2fdf3a28a3052501f5470908/airflow/utils/python_virtualenv_script.jinja2)
 )
   - The messages transferred from the docker container to the worker are split 
line by line to the logger, in order to
      - allow multiline messages such as Trace backs to maintain the indent 
(useful for [PEP-657](https://peps.python.org/pep-0657/) )
      - Manage buffered messages that should be individually printed but could 
be differed
      - Sherry on the cake : filtering on the message level and the file 
display the totality of the multi-line message (instead of only the first line)
   
   ## Illustration of the multiline splits
   
   Before :
   ```
   [2024-05-14T12:51:52.701+0000] {docker.py:436} INFO - + python3 
/tmp/script.py /tmp/script.in /tmp/script.out none /tmp/script.out
   [2024-05-14T12:51:52.741+0000] {docker.py:436} INFO - Traceback (most recent 
call last):
     File "/tmp/script.py", line 31, in <module>
       res = fails(*arg_dict["args"], **arg_dict["kwargs"])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/tmp/script.py", line 17, in fails
       a = 1 / 0
           ~~^~~
   ZeroDivisionError: division by zero
   [2024-05-14T12:51:52.955+0000] {taskinstance.py:454} INFO - ::group::Post 
task execution logs
   ```
   
   Now 
   
   ```
   [2024-05-14T12:50:17.655+0000] {docker.py:437} INFO - + python3 
/tmp/script.py /tmp/script.in /tmp/script.out none /tmp/script.out
   [2024-05-14T12:50:17.693+0000] {docker.py:437} INFO - Traceback (most recent 
call last):
   [2024-05-14T12:50:17.694+0000] {docker.py:437} INFO -   File 
"/tmp/script.py", line 31, in <module>
   [2024-05-14T12:50:17.694+0000] {docker.py:437} INFO -     res = 
fails(*arg_dict["args"], **arg_dict["kwargs"])
   [2024-05-14T12:50:17.694+0000] {docker.py:437} INFO -           
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   [2024-05-14T12:50:17.695+0000] {docker.py:437} INFO -   File 
"/tmp/script.py", line 17, in fails
   [2024-05-14T12:50:17.695+0000] {docker.py:437} INFO -     a = 1 / 0
   [2024-05-14T12:50:17.696+0000] {docker.py:437} INFO -         ~~^~~
   [2024-05-14T12:50:17.696+0000] {docker.py:437} INFO - ZeroDivisionError: 
division by zero
   [2024-05-14T12:50:17.876+0000] {taskinstance.py:454} INFO - ::group::Post 
task execution logs
   
   ```
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a 
newsfragment file, named `{pr_number}.significant.rst` or 
`{issue_number}.significant.rst`, in 
[newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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

Reply via email to