Skip to content

Error "NumericValueOutOfRange integer out of range" in scheduler, task_insance.priority_weight column overflow #22781

@kosteev

Description

@kosteev

Apache Airflow version

2.2.3

What happened

Scheduler fails with following exception in case of priority_weight_total method returning out of integer range value.

"Original exception was: (psycopg2.errors.NumericValueOutOfRange) integer out of range"

What you think should happen instead

No response

How to reproduce

DAG to reproduce issue.

import airflow
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import timedelta

default_args = {
    'start_date': airflow.utils.dates.days_ago(0),
    'retries': 1,
    'retry_delay': timedelta(minutes=5)
}

dag = DAG(
    'monitoring_sched',
    default_args=default_args,
    description='liveness monitoring dag',
    schedule_interval='*/20 * * * *',
    dagrun_timeout=timedelta(minutes=120))

# priority_weight has type int in Airflow DB, uses the maximum.

# priority_weight has type int in Airflow DB, uses the maximum.
t1 = BashOperator(
    task_id='echo',
    bash_command='echo test',
    dag=dag,
    queue='kubernetes',
    depends_on_past=False,
    priority_weight=2**31-1)

# priority_weight has type int in Airflow DB, uses the maximum.
t2 = BashOperator(
    task_id='sleep',
    bash_command='sleep 1900',
    queue='kubernetes',
    dag=dag,
    depends_on_past=False,
    priority_weight=2**31-1)


# priority_weight has type int in Airflow DB, uses the maximum.
t3 = BashOperator(
    task_id='ech2o',
    bash_command='echo done',
    dag=dag,
    queue='kubernetes',
    depends_on_past=False,
    priority_weight=2**31-1)

t1 >> t2 >> t3

Operating System

Composer

Versions of Apache Airflow Providers

No response

Deployment

Composer

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions