Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair different run_id for OpenLineage START and FAIL events. #36051

Merged

Conversation

kacpermuda
Copy link
Contributor

@kacpermuda kacpermuda commented Dec 4, 2023

There is an issue with OpenLineage FAIL event having different run_id than START event. This fixes the issue and add tests to prevent it from happening in the future.

The issue was that we decreased try_number in on_task_instance_failed as we wanted it to be the same as in on_task_instance_running (try_number is used to generate deterministic run_id). As it turned out, when on_task_instance_failed is called, the try_number is not yet automatically increased by Airflow, so we do not have to do that - it just need to be done in on_task_instance_success.

If You want to reproduce the issue run the below dag with OpenLineage integration, You should receive different run_id in START and FAIL event.

from airflow import DAG
from airflow.operators.bash import BashOperator
from datetime import datetime

with DAG(
    dag_id='test',
    start_date=datetime(2023, 11, 30),
    schedule_interval=None
) as dag:
    task = BashOperator(
        task_id='run_bash',
        bash_command='exit 1;'
    )

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@mobuchowski mobuchowski merged commit 35a1b7a into apache:main Dec 4, 2023
47 checks passed
@kacpermuda kacpermuda deleted the openlineage/fix-run-id-for-fail-events branch December 4, 2023 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants