Asquator commented on code in PR #53492: URL: https://github.com/apache/airflow/pull/53492#discussion_r2250151423
########## airflow-core/src/airflow/migrations/versions/0080_3_1_0_add_ti_max_active_tis_per_dagrun.py: ########## @@ -0,0 +1,57 @@ +# +# 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 callback_state to deadline. + +Revision ID: 2f49f2dae90c +Revises: f56f68b9e02f +Create Date: 2025-07-28 16:39:01.181132 +""" + +from __future__ import annotations + +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "2f49f2dae90c" +down_revision = "f56f68b9e02f" +branch_labels = None +depends_on = None +airflow_version = "3.1.0" + + +def upgrade(): + """Add callback_state to deadline.""" + with op.batch_alter_table("task_instance", schema=None) as batch_op: + batch_op.add_column(sa.Column("max_active_tis_per_dag", sa.Integer, nullable=True)) Review Comment: > During the migration as well the fields are not initialized. How does migrated data harm the scheduling? Do you mean existing task instances in one of the execution states that have concurrency limits? I can see the bug where the new scheduler will ignore the limits. We should manually reparse all the dags and add the fields to DB, it seems. > Even if this is just adding a few bytes per tuple... is there an option to make the same function w/o DB change? We need the fields in the DB to use them in a query. Regarding the table size, I see no other means to reduce it because we're in a system that heavily relies on SQL as its SSOT, and as long as we want features to be added, we must readily accept table extensions. task_instance is a flat table with a lot of params, some of them are duplicated across many TIs. Maybe it will be desirable to normalize it and extract the notorious task_template table or just a task_limits table in the long term. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
