From commits-return-12915-archive-asf-public=cust-asf.ponee.io@airflow.incubator.apache.org Wed Feb 28 23:13:07 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 2B96C180657 for ; Wed, 28 Feb 2018 23:13:06 +0100 (CET) Received: (qmail 75251 invoked by uid 500); 28 Feb 2018 22:13:06 -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 75242 invoked by uid 99); 28 Feb 2018 22:13:06 -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, 28 Feb 2018 22:13:06 +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 B98F7C01CA for ; Wed, 28 Feb 2018 22:13:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id pG7iPbhb7jdd for ; Wed, 28 Feb 2018 22:13:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 654B15F640 for ; Wed, 28 Feb 2018 22:13:02 +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 2A7F5E095D for ; Wed, 28 Feb 2018 22:13:01 +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 5D3B424766 for ; Wed, 28 Feb 2018 22:13:00 +0000 (UTC) Date: Wed, 28 Feb 2018 22:13:00 +0000 (UTC) From: "Christian Mladenov (JIRA)" To: commits@airflow.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AIRFLOW-2160) Changing task instance state fails when id or execution date contains a dot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AIRFLOW-2160?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 381102#comment-16381102 ]=20 Christian Mladenov commented on AIRFLOW-2160: --------------------------------------------- PR=C2=A0https://github.com/apache/incubator-airflow/pull/3081 > Changing task instance state fails when id or execution date contains a d= ot > -------------------------------------------------------------------------= -- > > Key: AIRFLOW-2160 > URL: https://issues.apache.org/jira/browse/AIRFLOW-2160 > Project: Apache Airflow > Issue Type: Bug > Components: ui, webapp > Affects Versions: Airflow 2.0, 1.9.1 > Reporter: Christian Mladenov > Assignee: Christian Mladenov > Priority: Minor > > When there is a dot in a task's ID or in its execution date [1], changing= its state from the UI fails. > What the user sees is the=C2=A0non-descript Oops: > {code:java} > ____/ ( ( ) ) \___ > /( ( ( ) _ )) ) )\ > (( ( )( ) ) ( ) ) > ((/ ( _( ) ( _) ) ( () ) ) > ( ( ( (_) (( ( ) .((_ ) . )_ > ( ( ) ( ( ) ) ) . ) ( ) > ( ( ( ( ) ( _ ( _) ). ) . ) ) ( ) > ( ( ( ) ( ) ( )) ) _)( ) ) ) > ( ( ( \ ) ( (_ ( ) ( ) ) ) ) )) ( ) > ( ( ( ( (_ ( ) ( _ ) ) ( ) ) ) > ( ( ( ( ( ) (_ ) ) ) _) ) _( ( ) > (( ( )( ( _ ) _) _(_ ( (_ ) > (_((__(_(__(( ( ( | ) ) ) )_))__))_)___) > ((__) \\||lll|l||/// \_)) > ( /(/ ( ) ) )\ ) > ( ( ( ( | | ) ) )\ ) > ( /(| / ( )) ) ) )) ) > ( ( ((((_(|)_))))) ) > ( ||\(|(|)|/|| ) > ( |(||(||)|||| ) > ( //|/l|||)|\\ \ ) > (/ / // /|//||||\\ \ \ \ _) > -------------------------------------------------------------------------= ------ > Node: d6b08a99dfda > -------------------------------------------------------------------------= ------ > Traceback (most recent call last): > File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1982, = in wsgi_app > response =3D self.full_dispatch_request() > File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1614, = in full_dispatch_request > rv =3D self.handle_user_exception(e) > File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1517, = in handle_user_exception > reraise(exc_type, exc_value, tb) > File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1612, = in full_dispatch_request > rv =3D self.dispatch_request() > File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1598, = in dispatch_request > return self.view_functions[rule.endpoint](**req.view_args) > File "/usr/local/lib/python2.7/site-packages/flask_admin/base.py", line= 69, in inner > return self._run_view(f, *args, **kwargs) > File "/usr/local/lib/python2.7/site-packages/flask_admin/base.py", line= 368, in _run_view > return fn(self, *args, **kwargs) > File "/usr/local/lib/python2.7/site-packages/flask_admin/model/base.py"= , line 2068, in action_view > return self.handle_action() > File "/usr/local/lib/python2.7/site-packages/flask_admin/actions.py", l= ine 113, in handle_action > response =3D handler[0](ids) > File "/usr/local/lib/python2.7/site-packages/airflow/utils/db.py", line= 69, in wrapper > return func(*args, **kwargs) > File "/usr/local/lib/python2.7/site-packages/airflow/www/views.py", lin= e 2591, in action_clear > raise Exception("Ooops") > Exception: Ooops{code} > The actual exception is something like: > {code:java} > Traceback (most recent call last): > File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1982, = in wsgi_app > response =3D self.full_dispatch_request() > File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1614, = in full_dispatch_request > rv =3D self.handle_user_exception(e) > File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1517, = in handle_user_exception > reraise(exc_type, exc_value, tb) > File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1612, = in full_dispatch_request > rv =3D self.dispatch_request() > File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1598, = in dispatch_request > return self.view_functions[rule.endpoint](**req.view_args) > File "/usr/local/lib/python2.7/site-packages/flask_admin/base.py", line= 69, in inner > return self._run_view(f, *args, **kwargs) > File "/usr/local/lib/python2.7/site-packages/flask_admin/base.py", line= 368, in _run_view > return fn(self, *args, **kwargs) > File "/usr/local/lib/python2.7/site-packages/flask_admin/model/base.py"= , line 2068, in action_view > return self.handle_action() > File "/usr/local/lib/python2.7/site-packages/flask_admin/actions.py", l= ine 113, in handle_action > response =3D handler[0](ids) > File "/usr/local/lib/python2.7/site-packages/airflow/utils/db.py", line= 69, in wrapper > return func(*args, **kwargs) > File "/usr/local/lib/python2.7/site-packages/airflow/www/views.py", lin= e 2573, in action_clear > execution_date =3D parse_execution_date(execution_date) > File "/usr/local/lib/python2.7/site-packages/airflow/utils/dates.py", l= ine 247, in parse_execution_date > return timezone.parse(execution_date_str) > File "/usr/local/lib/python2.7/site-packages/airflow/utils/timezone.py"= , line 152, in parse > return pendulum.parse(string, tz=3DTIMEZONE) > File "/usr/local/lib/python2.7/site-packages/pendulum/parser.py", line = 75, in parse > return Parser(**options).parse(text) > File "/usr/local/lib/python2.7/site-packages/pendulum/parser.py", line = 31, in parse > parsed =3D super(Parser, self).parse(text) > File "/usr/local/lib/python2.7/site-packages/pendulum/parsing/parser.py= ", line 297, in parse > return self.normalize(self._parse(text)) > File "/usr/local/lib/python2.7/site-packages/pendulum/parsing/parser.py= ", line 355, in _parse > raise ParserError('Invalid date string: {}'.format(text)) > ParserError: Invalid date string: 2018-02-28 20:21:40..819909+00:00{code} > The reason for this is that Flask-Admin's {{iterencode}} function encodes= composite primary keys using dot as the escape symbol. If there is already= a dot in any of the values, it is doubled [2]. > On decoding however, Airflow is currently just splitting the string on a = comma [3]. > The solution would be simple - use Flask-Admin's {{iterdecode}} function = which is already used in another place in views.py [4]. > [1] Dot in the execution date happens when a DAG is run manually. Then th= e execution date can contain milliseconds (at least in Postgres) > [2] iterencode escapes a dot with 2 dots:=C2=A0https://github.com/flask-a= dmin/flask-admin/blob/d57048b041c737f8f4b61f9a2260fc0607dff2aa/flask_admin/= tools.py#L118 > [3] > [https://github.com/apache/incubator-airflow/blob/343af062b6426e0e5e5cd1f= a2d8c397ad4c626a3/airflow/www/views.py#L2573]=C2=A0and=C2=A0 [https://githu= b.com/apache/incubator-airflow/blob/343af062b6426e0e5e5cd1fa2d8c397ad4c626a= 3/airflow/www/views.py#L2607] > [4]=C2=A0 > [https://github.com/apache/incubator-airflow/blob/343af062b6426e0e5e5cd1f= a2d8c397ad4c626a3/airflow/www/views.py#L2629] > =C2=A0 > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)