You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Ace Haidrey (JIRA)" <ji...@apache.org> on 2017/07/29 11:03:00 UTC

[jira] [Comment Edited] (AIRFLOW-1239) base_task_runner logging with unicode values on Py27

    [ https://issues.apache.org/jira/browse/AIRFLOW-1239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16106097#comment-16106097 ] 

Ace Haidrey edited comment on AIRFLOW-1239 at 7/29/17 11:02 AM:
----------------------------------------------------------------

Added the below to pr: https://github.com/apache/incubator-airflow/pull/2318

Agree with @AllisonWang comments. I am having these same error messages looking like the following: 
{code}
[2017-07-28 23:03:03,358] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/ahaidrey/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/task_runner/base_task_runner.py", line 95, in _read_task_logs
    self.logger.info('Subtask: {}'.format(line.rstrip('\n')))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 66: ordinal not in range(128)
{code}
But after adding the line {{from __future__ import unicode_literals}} (like Allison's suggestion) it goes away and I have something like the following in my worker logs:
{code}
[2017-07-29 03:57:05,707] {__init__.py:57} INFO - Using executor CeleryExecutor
[2017-07-29 03:57:05,833] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[2017-07-29 03:57:05,879] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
{code}
I read this [SO post|https://stackoverflow.com/questions/3235386/python-using-format-on-a-unicode-escaped-string] to get that solution.


was (Author: ahaidrey):
Added the below to pr: https://github.com/apache/incubator-airflow/pull/2318

Agree with @AllisonWang comments. I am having these same error messages looking like the following: 
{code}
[2017-07-28 23:03:03,358] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/ahaidrey/.virtualenvs/airflow/local/lib/python2.7/site-packages/airflow/task_runner/base_task_runner.py", line 95, in _read_task_logs
    self.logger.info('Subtask: {}'.format(line.rstrip('\n')))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 66: ordinal not in range(128)
{code}
But after adding the line `from __future__ import unicode_literals` (like Allison's suggestion) it goes away and I have something like the following in my worker logs:
{code}
[2017-07-29 03:57:05,707] {__init__.py:57} INFO - Using executor CeleryExecutor
[2017-07-29 03:57:05,833] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[2017-07-29 03:57:05,879] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
{code}
I read this [SO post|https://stackoverflow.com/questions/3235386/python-using-format-on-a-unicode-escaped-string] to get that solution.

> base_task_runner logging with unicode values on Py27
> ----------------------------------------------------
>
>                 Key: AIRFLOW-1239
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1239
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: worker
>            Reporter: yanghanbing
>
> Exception in thread Thread-1:
> Traceback (most recent call last):
>   File "/usr/lib64/python2.7/threading.py", line 811, in __bootstrap_inner
>     self.run()
>   File "/usr/lib64/python2.7/threading.py", line 764, in run
>     self.__target(*self.__args, **self.__kwargs)
>   File "/opt/cloudera-manager/cm-5.5.1/run/cloudera-scm-server/airflow/env/lib/python2.7/site-packages/airflow/task_runner/base_task_runner.py", line 95, in _read_task_logs
>     self.logger.info('Subtask: {}'.format(line.rstrip('\n')))
> UnicodeEncodeError: 'ascii' codec can't encode characters in position 107-108: ordinal not in range(128)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)