You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/01/19 21:10:17 UTC

[GitHub] [airflow] yanxke opened a new issue #20966: Exception when parsing log

yanxke opened a new issue #20966:
URL: https://github.com/apache/airflow/issues/20966


   ### Apache Airflow version
   
   2.1.4
   
   ### What happened
   
   [2022-01-19 13:42:46,107] {taskinstance.py:1463} ERROR - Task failed with exception
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1165, in _run_raw_task
       self._prepare_and_execute_task_with_callbacks(context, task)
     File "/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1283, in _prepare_and_execute_task_with_callbacks
       result = self._execute_task(context, task_copy)
     File "/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1313, in _execute_task
       result = task_copy.execute(context=context)
     File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py", line 367, in execute
       final_state, remote_pod, result = self.create_new_pod_for_operator(labels, launcher)
     File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py", line 521, in create_new_pod_for_operator
       final_state, remote_pod, result = launcher.monitor_pod(pod=self.pod, get_logs=self.get_logs)
     File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/cncf/kubernetes/utils/pod_launcher.py", line 148, in monitor_pod
       timestamp, message = self.parse_log_line(line.decode('utf-8'))
   UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 16413-16414: invalid continuation byte
   
   
   ### What you expected to happen
   
   _No response_
   
   ### How to reproduce
   
   _No response_
   
   ### Operating System
   
   Debian GNU/Linux 10 (buster)
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-amazon==2.2.0
   apache-airflow-providers-celery==2.0.0
   apache-airflow-providers-cncf-kubernetes==2.0.2
   apache-airflow-providers-docker==2.1.1
   apache-airflow-providers-elasticsearch==2.0.3
   apache-airflow-providers-ftp==2.0.1
   apache-airflow-providers-google==5.1.0
   apache-airflow-providers-grpc==2.0.1
   apache-airflow-providers-hashicorp==2.1.0
   apache-airflow-providers-http==2.0.1
   apache-airflow-providers-imap==2.0.1
   apache-airflow-providers-microsoft-azure==3.1.1
   apache-airflow-providers-mysql==2.1.1
   apache-airflow-providers-postgres==2.2.0
   apache-airflow-providers-redis==2.0.1
   apache-airflow-providers-sendgrid==2.0.1
   apache-airflow-providers-sftp==2.1.1
   apache-airflow-providers-slack==4.0.1
   apache-airflow-providers-sqlite==2.0.1
   apache-airflow-providers-ssh==2.1.1
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   Always on a specific docker container.
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] yanxke commented on issue #20966: Exception when parsing log

Posted by GitBox <gi...@apache.org>.
yanxke commented on issue #20966:
URL: https://github.com/apache/airflow/issues/20966#issuecomment-1017778077


   Thank you for your quick response.  You mean catch the exception in the DAG definition code?  We deployed Airflow using Helm and do not have direct access to the code.


-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on issue #20966: Exception when parsing log

Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #20966:
URL: https://github.com/apache/airflow/issues/20966#issuecomment-1019593545


   Assigned you to the issue @microhuang !


-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] microhuang edited a comment on issue #20966: Exception when parsing log

Posted by GitBox <gi...@apache.org>.
microhuang edited a comment on issue #20966:
URL: https://github.com/apache/airflow/issues/20966#issuecomment-1017056466


   When the task outputs some strange characters, there will be errors when using UTF-8 decoding due to different encoding. The same problem also exists in (airflow/hooks/subprocess.py : line 88 : version 2.2.3). You should try to catch it. I will submit a PR later.
   
   e.g.
   
   ```
               line = ''
               for raw_line in iter(self.sub_process.stdout.readline, b''):
                   try:
                       line = raw_line.decode(output_encoding).rstrip()
                   except UnicodeDecodeError as err:
                       print(err, output_encoding, raw_line)
                   self.log.info("%s", line)
   ```
   


-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk edited a comment on issue #20966: Exception when parsing log

Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on issue #20966:
URL: https://github.com/apache/airflow/issues/20966#issuecomment-1019593475


   Would be great @microhuang  - this is good assesment - and fixing it in similar way as in subprocess.py seems a good idea.


-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] microhuang commented on issue #20966: Exception when parsing log

Posted by GitBox <gi...@apache.org>.
microhuang commented on issue #20966:
URL: https://github.com/apache/airflow/issues/20966#issuecomment-1018170876


   > Thank you for your quick response. You mean catch the exception in the DAG definition code? We deployed Airflow using Helm and do not have direct access to the code.
   
   Yes. First of all, this error is due to the inconsistent coding content output by the task itself. Correcting the task code can avoid this error. Secondly, using try-catch or specifying the errors parameter during decoding can avoid this error in airflow. You can modify the code here through data volume mapping, customize your own image, and wait for the next version of airflow (if you're not in a hurry). For official docode documentation, please refer to: https://docs.python.org/3.10/library/stdtypes.html?highlight=decode#bytes.decode . 
   Sorry, English is not my native language。


-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] microhuang commented on issue #20966: Exception when parsing log

Posted by GitBox <gi...@apache.org>.
microhuang commented on issue #20966:
URL: https://github.com/apache/airflow/issues/20966#issuecomment-1017056466


   When the task outputs some strange characters, there will be errors when using UTF-8 decoding due to different encoding. The same problem also exists in (airflow/hooks/subprocess.py : line 88 : version 2.2.3). You should try to catch it. I will submit a PR later.


-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on issue #20966: Exception when parsing log

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #20966:
URL: https://github.com/apache/airflow/issues/20966#issuecomment-1016871353


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] microhuang edited a comment on issue #20966: Exception when parsing log

Posted by GitBox <gi...@apache.org>.
microhuang edited a comment on issue #20966:
URL: https://github.com/apache/airflow/issues/20966#issuecomment-1018170876


   > Thank you for your quick response. You mean catch the exception in the DAG definition code? We deployed Airflow using Helm and do not have direct access to the code.
   
   Yes. First of all, this error is due to the inconsistent coding content output by the task itself. Correcting the task code can avoid this error. Secondly, using try-catch or specifying the errors parameter during decoding can avoid this error in airflow. You can modify the code here through DataVolume mapping, customize your own image, and wait for the next version of airflow (if you're not in a hurry). For official docode documentation, please refer to: https://docs.python.org/3.10/library/stdtypes.html?highlight=decode#bytes.decode . 
   Sorry, English is not my native language。


-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on issue #20966: Exception when parsing log

Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #20966:
URL: https://github.com/apache/airflow/issues/20966#issuecomment-1019593475


   Would be greate @microhuang  - this is good assesment - and fixing it in similar way as in subprocess.py seems a good idea.


-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org