Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 88DC3200C38 for ; Wed, 15 Mar 2017 23:13:47 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 876BF160B60; Wed, 15 Mar 2017 22:13:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D29BB160B78 for ; Wed, 15 Mar 2017 23:13:46 +0100 (CET) Received: (qmail 42303 invoked by uid 500); 15 Mar 2017 22:13:46 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 42294 invoked by uid 99); 15 Mar 2017 22:13:46 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Mar 2017 22:13:46 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id A801F1A031F for ; Wed, 15 Mar 2017 22:13:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.651 X-Spam-Level: X-Spam-Status: No, score=0.651 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id c-k70-K9H9un for ; Wed, 15 Mar 2017 22:13:45 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id A92B45F4AA for ; Wed, 15 Mar 2017 22:13:44 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 7BFBAE026E for ; Wed, 15 Mar 2017 22:13:42 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id AFD2D24369 for ; Wed, 15 Mar 2017 22:13:41 +0000 (UTC) Date: Wed, 15 Mar 2017 22:13:41 +0000 (UTC) From: "Vitor Baptista (JIRA)" To: commits@airflow.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (AIRFLOW-990) DockerOperator fails when logging unicode string MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 15 Mar 2017 22:13:47 -0000 Vitor Baptista created AIRFLOW-990: -------------------------------------- Summary: DockerOperator fails when logging unicode string Key: AIRFLOW-990 URL: https://issues.apache.org/jira/browse/AIRFLOW-990 Project: Apache Airflow Issue Type: Bug Components: docker Affects Versions: Airflow 1.7.1 Environment: Python 2.7 Reporter: Vitor Baptista On line https://github.com/apache/incubator-airflow/blob/1.7.1.3/airflow/operators/docker_operator.py#L164, we're calling: ``` for line in self.cli.logs(container=self.container['Id'], stream=True): logging.info("{}".format(line.strip())) ``` If `self.cli.logs()` return a string with a unicode character, this raises the UnicodeDecodeError: ``` Traceback (most recent call last): File "/usr/lib/python2.7/logging/__init__.py", line 861, in emit msg = self.format(record) File "/usr/lib/python2.7/logging/__init__.py", line 734, in format return fmt.format(record) File "/usr/lib/python2.7/logging/__init__.py", line 476, in format raise e UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 0: ordinal not in range(128) Logged from file docker_operator.py, line 165 ``` A possible fix is to change that line to `logging.info(line.decode('utf-8').strip())`. This error doesn't happen on Python3. I haven't tested, but reading the code it seems the same error exists on `master` as well. -- This message was sent by Atlassian JIRA (v6.3.15#6346)