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 227F4200D4F for ; Wed, 6 Dec 2017 17:18:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 21180160C08; Wed, 6 Dec 2017 16:18:07 +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 4026A160BFD for ; Wed, 6 Dec 2017 17:18:06 +0100 (CET) Received: (qmail 97310 invoked by uid 500); 6 Dec 2017 16:18:05 -0000 Mailing-List: contact dev-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 dev@airflow.incubator.apache.org Received: (qmail 97297 invoked by uid 99); 6 Dec 2017 16:18:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Dec 2017 16:18:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 2EE37C09F4 for ; Wed, 6 Dec 2017 16:18:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.12 X-Spam-Level: X-Spam-Status: No, score=-0.12 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id g9EfmpwwdTiT for ; Wed, 6 Dec 2017 16:18:02 +0000 (UTC) Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id C59445F253 for ; Wed, 6 Dec 2017 16:18:01 +0000 (UTC) Received: by mail-wm0-f48.google.com with SMTP id i11so8039557wmf.4 for ; Wed, 06 Dec 2017 08:18:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:date:subject:message-id :references:in-reply-to:to; bh=YizVr/zMYECpoSD7/j29mXS/GMXVoomhEJsSTtUaiPU=; b=GsKPsZLUgpGsJ13MeIWzSLDwToLgla7Nv/1FY1Oi9JK2XN/thhyhSWWbvo+DWno7A1 FohE7/MpGIqBejCojDvsotMquxmNPSvNtCJpY0O3lISf7Wi+Fd3WlUSOBANGQK3sBsU1 9CcM0TY07NHAVgxTXFSIpq7FZqScSaUasbbRaX+9zBHFTO0HuKgzqrZa7CXn7P50oeFm 0XZzGiZ8LINhRA/LmEbecYbfLprRIE+1aialqYVlh0mehUO4CM8RFWOUXJsB4myq4to7 9LysllI3klMZC3Ux5Uhigt7JPxS6wQf7oBFCBQBApb58e8Cl8T3f4TL72VGKimaarkxb V3/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version:date :subject:message-id:references:in-reply-to:to; bh=YizVr/zMYECpoSD7/j29mXS/GMXVoomhEJsSTtUaiPU=; b=SYFlzYZUE0RLnUT1wuIPuXp9Dl3GLFLMk+dNCqVLAoWX/fTnkr2b7ujH4HNjKGoNJ1 A4GlKol+qY1ZI6YOz4crN9qMasmhAJNPRFyvwy5+krBJ9B7i4Ibmj5P8OlquxvxWzvGF aThowZ0edo/u3f0TCkiKSCvTT4TweM1qjkok3oHRBy08TbolPCwB0mUMHTTTGhjovgkn dgVrmbVl490px15Iw3HSPnPIxuerOyiiSWKCrD+r13zPNyitIMkM7+LP+FqIi7n7ij0M OsgbE1sJqwZpC/i1UG0n1eID6lw7A8y15TTHd2rffZEWnVTNurOaRZSvb2pF3mNcSouH 2Rag== X-Gm-Message-State: AKGB3mLzBoankasWsZl2CeaY3XjKii20okY/LAgMP41X6tfjC61AYdE8 Uz/p73T1F2iJXZGQAeLkyHYpj1+CzL9U X-Google-Smtp-Source: AGs4zMbuASqMMdDtoD3RSjI8c9sgxX4fJRk0ukYWcoEZICQ1XHhUgZMEPTzczRkjpSkZ16yNhy4ClA== X-Received: by 10.80.180.187 with SMTP id w56mr18348933edd.3.1512577080390; Wed, 06 Dec 2017 08:18:00 -0800 (PST) Received: from [10.0.1.99] (f248061.upc-f.chello.nl. [80.56.248.61]) by smtp.gmail.com with ESMTPSA id f36sm1386709edd.82.2017.12.06.08.17.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Dec 2017 08:17:59 -0800 (PST) From: Bolke de Bruin Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Date: Wed, 6 Dec 2017 17:17:58 +0100 Subject: Re: Xcom_push is broken - probably after the timezone awareness Message-Id: References: <179836E3-F517-4E05-94C9-E65A2813D223@gmail.com> In-Reply-To: To: dev@airflow.incubator.apache.org X-Mailer: iPad Mail (15C114) archived-at: Wed, 06 Dec 2017 16:18:07 -0000 1. Naive dates are supported for initalization of DAGs and will be, after th= e patch of Sumit, for directly instantiated TaskInstances. XCom can store ar= bitrary information so it is not affected.=20 2. Any arithmetic you do on dates will need to happen with a timezone associ= ated with it. This rare, you normally do date + datetime. However if you wan= t to compare dates you will need to make it timezone aware. 3. Timezone support will not be in 1.9.0=20 4. Logging.info will be supported in 1.9.0 final So no reason to panic I would say ;-) Bolke Verstuurd vanaf mijn iPad > Op 6 dec. 2017 om 16:35 heeft Boris Tyukin het vol= gende geschreven: >=20 > hm...can you elaborate why we cannot use "from datetime import datetime".= > it worked before just fine :) i was under an impression that any pickle > serializable type can be using with xcom. >=20 > Along with a recent change in logs (logging.info does not write to log > files anymore), this makes upgrade to 1.9 quite difficult. >=20 >> On Wed, Dec 6, 2017 at 9:19 AM, Bolke de Bruin wrote:= >>=20 >> You should not use a naive datetime as it mentioned. So instead of of >> using =E2=80=9Cfrom datetime import datetime=E2=80=9D use =E2=80=9Cfrom a= irflow.utils.timezone >> import datetime=E2=80=9D. This sets the timezone information that is requ= ired to >> the default configured in airflow.cfg. >>=20 >> A patch that sets the default timezone for TaskInstance is also helpful i= n >> this case and will be welcomed. How to do it you can find in the DAG clas= s. >>=20 >> Bolke. >>=20 >>> On 6 Dec 2017, at 15:13, Sumit Maheshwari >> wrote: >>>=20 >>> Folks, >>>=20 >>> I've some testes, which used to pass earlier, but recently they started >> failing. When I looked closely it appeared that xcom_push is behaving >> differently. >>>=20 >>>=20 >>> So this is is the current code, which throws the error mentioned below >> to it >>> DEFAULT_DATE =3D datetime(2017, 1, 1) >>> ti =3D TaskInstance(task=3Dtask, execution_date=3DDEFAULT_DATE) >>> ti.xcom_push('abcd', 12345) >>>=20 >>> File "build/bdist.macosx-10.11-intel/egg/sqlalchemy_utc.py", line 31, >> in process_bind_param >>> raise ValueError('naive datetime is disallowed') >>> StatementError: (exceptions.ValueError) naive datetime is disallowed >> [SQL: u'DELETE FROM xcom WHERE xcom."key" =3D ? AND xcom.execution_date =3D= ? >> AND xcom.task_id =3D ? AND xcom.dag_id =3D ?'] [parameters: [{}]] >>>=20 >>> When I changed the execution date param to a string, it fails with other= >> error. >>> ti =3D TaskInstance(task=3Dtask, execution_date=3DDEFAULT_DATE.isoformat= ()) >>> ti.xcom_push('abcd', 12345) >>>=20 >>> File "build/bdist.macosx-10.11-intel/egg/sqlalchemy_utc.py", line 29, >> in process_bind_param >>> repr(value)) >>> StatementError: (exceptions.TypeError) expected datetime.datetime, not >> '2017-01-01T00:00:00' [SQL: u'DELETE FROM xcom WHERE xcom."key" =3D ? AND= >> xcom.execution_date =3D ? AND xcom.task_id =3D ? AND xcom.dag_id =3D ?'] >> [parameters: [{}]] >>>=20 >>> Somehow I feel that it is linked with sqlalchemy_utc library, though I >> may be wrong and its just missing some timezone related settings. >>> Please let me know if anyone else has faced this issue as well. >>>=20 >>> Thanks, >>> Sumit >>>=20 >>>=20 >>=20 >>=20