Repository: incubator-airflow Updated Branches: refs/heads/master 6a668e741 -> 57bf99659
[AIRFLOW-2604] Add index to task_fail Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/d00762cb Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/d00762cb Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/d00762cb Branch: refs/heads/master Commit: d00762cb914803341c5d019d14385d249346d601 Parents: dbcb93c Author: Stefan Seelmann <m...@stefan-seelmann.de> Authored: Sun Jun 17 22:17:11 2018 +0200 Committer: Stefan Seelmann <m...@stefan-seelmann.de> Committed: Fri Jun 22 20:33:05 2018 +0200 ---------------------------------------------------------------------- .../versions/9635ae0956e7_index_faskfail.py | 44 ++++++++++++++++++++ airflow/models.py | 5 +++ 2 files changed, 49 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/d00762cb/airflow/migrations/versions/9635ae0956e7_index_faskfail.py ---------------------------------------------------------------------- diff --git a/airflow/migrations/versions/9635ae0956e7_index_faskfail.py b/airflow/migrations/versions/9635ae0956e7_index_faskfail.py new file mode 100644 index 0000000..da69846 --- /dev/null +++ b/airflow/migrations/versions/9635ae0956e7_index_faskfail.py @@ -0,0 +1,44 @@ +# flake8: noqa +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +"""index-faskfail + +Revision ID: 9635ae0956e7 +Revises: 856955da8476 +Create Date: 2018-06-17 21:40:01.963540 + +""" + +# revision identifiers, used by Alembic. +revision = '9635ae0956e7' +down_revision = '856955da8476' +branch_labels = None +depends_on = None + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + op.create_index('idx_task_fail_dag_task_date', 'task_fail', ['dag_id', 'task_id', 'execution_date'], unique=False) + + +def downgrade(): + op.drop_index('idx_task_fail_dag_task_date', table_name='task_fail') + http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/d00762cb/airflow/models.py ---------------------------------------------------------------------- diff --git a/airflow/models.py b/airflow/models.py index 381e9d3..423612c 100755 --- a/airflow/models.py +++ b/airflow/models.py @@ -2057,6 +2057,11 @@ class TaskFail(Base): end_date = Column(UtcDateTime) duration = Column(Integer) + __table_args__ = ( + Index('idx_task_fail_dag_task_date', dag_id, task_id, execution_date, + unique=False), + ) + def __init__(self, task, execution_date, start_date, end_date): self.dag_id = task.dag_id self.task_id = task.task_id