Skip to content

"Failed to load task run error" occur in "on_failure_callback" after upgrading from 2.0.0 to 2.1.2 #17045

@kaojunsong

Description

@kaojunsong

Apache Airflow version: 2.1.2

Kubernetes version (if you are using kubernetes) (use kubectl version): "v1.19.6"

Environment:

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

What happened: "Failed to load task run error" occur in "on_failure_callback" after task failed

What you expected to happen: The actually exception should be caught

How to reproduce it:

def validate_parameters(**kwargs):
    conf = kwargs.get('dag_run').conf
    kwargs['ti'].xcom_push(key='conf', value=conf)
    job_identifier = conf.get('job_identifier')
    s3_connection_id = conf.get('s3_connection_id')
    if not job_identifier:
        raise ParameterValidationException(reason='job_identifier should not be empty')
    if not s3_connection_id:
        raise ParameterValidationException(reason='s3_connection_id should not be empty')
  

def handle_failure(context):
    exception = context.get('exception')
    // the ParameterValidationException should be caught here, but I got "Failed to load task run error"
    // other business
    

DEFAULT_ARGS = {
    'owner': 'boss_admin',
    'start_date': datetime(2021, 1, 2),
    "retries": 0,
    'on_failure_callback': handle_failure
}

Anything else we need to know:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions