Skip to content

Conversation

@Lohith625
Copy link
Contributor

Was generative AI tooling used to co-author this PR?

  • [X ] Yes

Generated-by: ChatGPT following the guidelines


This PR adds support for passing a note to TriggerDagRunOperator, allowing users to attach contextual information when triggering DAG runs directly from the operator.

What is changed

  • Added a new optional note parameter to TriggerDagRunOperator
  • Ensured the note is logged when a DAG is triggered
  • Maintained backward compatibility across Airflow versions:
    • Airflow 3.x: note is logged before raising DagRunTriggerException
    • Airflow 2.x: note is logged during normal execution
  • Added unit tests covering both Airflow 2 and Airflow 3 code paths
  • Updated the standard provider example DAG to demonstrate usage of the note parameter

Why this is needed

Currently, adding a note to a triggered DAG run is only possible via the API. This change enables users to pass notes directly from TriggerDagRunOperator, improving usability and reducing the need for additional API calls or custom logic.

Tests

  • Added unit tests in:
    • TestDagRunOperator (Airflow 3)
    • TestDagRunOperatorAF2 (Airflow 2)
  • Verified locally using pytest and Breeze

Documentation

  • Updated example DAG in the Standard provider to show how to use the note parameter

related: #56543

@Lohith625
Copy link
Contributor Author

Lohith625 commented Jan 13, 2026

I added a small Airflow 2–specific unit test to ensure the note is handled correctly in the AF2 execution path, since the trigger flow differs from AF3.

If maintainers feel the AF2 test or any part of the implementation is unnecessary or should be handled differently, I’m very happy to adjust or simplify it based on feedback.

Looking forward to your review

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

This PR is a duplicate of #60407 (most comments there holds for here). I would recommend closing this one.

Comment on lines +289 to +290
if self.note:
self.log.info("Triggered DAG with note: %s", self.note)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we can ever reach that? Having a note passed down in AF2, can we?

@pierrejeambrun
Copy link
Member

Closing, same reason as:
#60407 (review)

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