[
https://issues.apache.org/jira/browse/AIRFLOW-3338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Cheng Yichao updated AIRFLOW-3338:
----------------------------------
Description:
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.
The problem is fixed after version 1.9.0.
was:
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.
> 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.1, 1.8.2
> Reporter: Cheng Yichao
> Priority: Major
>
> 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.
> The problem is fixed after version 1.9.0.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)