Skip to content

Conversation

@antonlin1
Copy link
Contributor

@antonlin1 antonlin1 commented Jun 19, 2025

Using airflow 3.0.1 and apache-airflow-providers-openlineage @ git+https://github.com/apache/airflow@398ba8672f18e43fa010fdd792f60fae19aa51b8#subdirectory=providers/openlineage following error is thrown in openlineage provider:

ERROR - Task failed with exception: source="task"
AttributeError: 'RuntimeTaskInstance' object has no attribute 'dag_run'
File "/usr/local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py", line 838 in run

File "/usr/local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py", line 1130 in _execute_task

File "/usr/local/lib/python3.12/site-packages/airflow/sdk/bases/operator.py", line 408 in wrapper

File "/opt/airflow/plugins/dd_airflow_operators/yoshi_spark/yoshi_spark_operator.py", line 97 in execute

File "/opt/airflow/plugins/dd_airflow_operators/yoshi_spark/yoshi_spark_operator.py", line 124 in _create_spark_conf

File "/usr/local/lib/python3.12/site-packages/airflow/providers/openlineage/utils/spark.py", line 175 in inject_parent_job_information_into_spark_properties

File "/usr/local/lib/python3.12/site-packages/airflow/providers/openlineage/utils/spark.py", line 53 in _get_parent_job_information_as_spark_properties

File "/usr/local/lib/python3.12/site-packages/airflow/providers/openlineage/plugins/macros.py", line 120 in lineage_root_run_id

File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 989 in __getattr__

This seems to be because airflow 3 now instantiates a RuntimeTaskInstance which as opposed to airflow 2, does not have an immediate .dagRun member.

testing

  • fix unit tested. If removing fix and running unit test, the error above is reproduced

@antonlin1 antonlin1 requested a review from mobuchowski as a code owner June 19, 2025 12:06
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 19, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@antonlin1 antonlin1 force-pushed the antonlin/fix_dag_run_clear_number branch 2 times, most recently from cb11f68 to 3a84b7d Compare June 19, 2025 13:03
@antonlin1 antonlin1 force-pushed the antonlin/fix_dag_run_clear_number branch from 3a84b7d to 193e433 Compare June 19, 2025 13:08
Copy link
Contributor

@shahar1 shahar1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, welcome to Apache Airflow and thanks for your contribution!

@shahar1 shahar1 merged commit 5e74ec4 into apache:main Jun 19, 2025
3 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 19, 2025

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

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