-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'queued' state to DagRun (#16401)
This change adds queued state to DagRun. Newly created DagRuns start in the queued state, are then moved to the running state after satisfying the DAG's max_active_runs. If the Dag doesn't have max_active_runs, the DagRuns are moved to running state immediately Clearing a DagRun sets the state to queued state Closes: #9975, #16366 (cherry picked from commit 6611ffd)
- Loading branch information
1 parent
d81d8fc
commit 95ef3e3
Showing
18 changed files
with
338 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
airflow/migrations/versions/97cdd93827b8_add_queued_at_column_to_dagrun_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# | ||
# 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. | ||
|
||
"""Add queued_at column to dagrun table | ||
Revision ID: 97cdd93827b8 | ||
Revises: a13f7613ad25 | ||
Create Date: 2021-06-29 21:53:48.059438 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import mssql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '97cdd93827b8' | ||
down_revision = 'a13f7613ad25' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
"""Apply Add queued_at column to dagrun table""" | ||
conn = op.get_bind() | ||
if conn.dialect.name == "mssql": | ||
op.add_column('dag_run', sa.Column('queued_at', mssql.DATETIME2(precision=6), nullable=True)) | ||
else: | ||
op.add_column('dag_run', sa.Column('queued_at', sa.DateTime(), nullable=True)) | ||
|
||
|
||
def downgrade(): | ||
"""Unapply Add queued_at column to dagrun table""" | ||
op.drop_column('dag_run', "queued_at") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.