Cheng Yichao created AIRFLOW-3338:
-------------------------------------

             Summary: Task runner fail to dump log if stdout of substask 
contains Chinese characters
                 Key: AIRFLOW-3338
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3338
             Project: Apache Airflow
          Issue Type: Bug
          Components: core
    Affects Versions: 1.8.2, 1.8.1
            Reporter: Cheng Yichao


Code:
{code:java}
# At /airflow/task_runner/base_task_runner.py
def _read_task_logs(self, stream):
  while True:
    line = stream.readline().decode('utf-8')
    if len(line) == 0:
       break
    self.logger.info('Subtask: {}'.format(line.rstrip('\n'))){code}
Error message:
{code:java}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: 
ordinal not in range(128){code}
Behavior:

When a subtask tries to print Chinese characters, the above exception is throw.

The problem is that if the argument of 'format' is Unicode string, then the 
format string is also need to be a Unicode string.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to