airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Add note to triggerdagrunoperator

Open Lohith625 opened this issue 2 months ago • 8 comments


Description

Added support for passing a note to TriggerDagRunOperator.

Use Case

Currently, notes can only be passed via the API.
This PR adds a note argument to TriggerDagRunOperator for easier usage.

Related Issue

Closes: #56543

^ 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 airflow-core/newsfragments.

Lohith625 avatar Oct 21 '25 05:10 Lohith625

convert it to draft as lots of conflicts need to be resolved

Lee-W avatar Oct 21 '25 07:10 Lee-W

Also, please check if the note gets passed correctly into the TriggerDagRunRequest and stored as expected. Maybe a unit or functional test for that path?

You could also check if you can add this to the operator’s example DAGs (under example_dags/) to help users discover it more easily.

KoviAnusha avatar Oct 22 '25 06:10 KoviAnusha

Hi everyone ,

I’ve completed all the requested updates for this PR. I’ve implemented the note parameter for TriggerDagRunOperator, added an example DAG, and resolved all merge conflicts. I also performed a local unit test to verify that the note value is being correctly passed, even though I wasn’t able to run the full Breeze test suite due to environment issues.

I’ve done my best to ensure the logic is solid and that everything builds cleanly. Most of the CI checks have passed successfully , but one job (Build CI image 3.10) failed with a permission error (Operation not permitted: 'source/bin/python'), which seems unrelated to my changes.

Could a maintainer please re-run that job or take a look when convenient?

Thank you for your patience and support throughout this process! 🙏

Lohith625 avatar Oct 25 '25 12:10 Lohith625

Hi everyone ,

I’ve completed all the requested updates for this PR. I’ve implemented the note parameter for TriggerDagRunOperator, added an example DAG, and resolved all merge conflicts. I also performed a local unit test to verify that the note value is being correctly passed, even though I wasn’t able to run the full Breeze test suite due to environment issues.

I’ve done my best to ensure the logic is solid and that everything builds cleanly. Most of the CI checks have passed successfully , but one job (Build CI image 3.10) failed with a permission error (Operation not permitted: 'source/bin/python'), which seems unrelated to my changes.

@Lohith625 , Can you please recheck and remove all changes from files that are unrelated to the current Issue you are working on? For instance, why do you have so many changes in files related to breeze?

rawwar avatar Oct 25 '25 12:10 rawwar

I apologize for not cleaning up the unrelated files earlier. As a beginner, I initially misunderstood some parts of the process. I’ve now cleaned everything properly — only the 3 files related to my issue remain (the operator, its test, and the example DAG). Thank you for your patience and guidance throughout this process 🙏

Lohith625 avatar Oct 27 '25 16:10 Lohith625

I apologize for not cleaning up the unrelated files earlier. As a beginner, I initially misunderstood some parts of the process. I’ve now cleaned everything properly — only the 3 files related to my issue remain (the operator, its test, and the example DAG). Thank you for your patience and guidance throughout this process 🙏

Please note that both static checks and unit tests fail -

  1. regarding statick checks, please refer to breeze docs
  2. Regarding the tests, they fail because of using the note param in DagRunTriggerException.

In addition to the above, I recommend to try asking for mentorship in #new-contributors channel on the Slack channel.

shahar1 avatar Nov 01 '25 06:11 shahar1

You have some problems with static checks in your PR - I assume would be helpful to install prek and re-format the code. Following this here: https://github.com/apache/airflow/blob/main/contributing-docs/03a_contributors_quick_start_beginners.rst

For the errors like "TypeError: DagRunTriggerException.init() got an unexpected keyword argument 'note'" you need to adjust the parameter for the constructor of the Exception class. The exception is in Airflow Core but the provider that wants to trigger is in standard provider. Note that the provider can be upgraded and used also in other Airflow core versions so if you adjust the Exception it will fail in backwards-compatability. I'd leave out the note from the Exception, I assume usually the note is not the cause of exception.

jscheffl avatar Nov 01 '25 13:11 jscheffl

Looks like we still have many failures that need to be resolved before the next review round. Mark it as draft

Lee-W avatar Nov 19 '25 10:11 Lee-W

Could you please rebase your branch?

henry3260 avatar Dec 15 '25 15:12 henry3260

Could you please rebase your branch?

Thanks for the suggestion!

I’ve rebased the branch onto the latest apache/main and updated the PR. All checks are now passing.

Lohith625 avatar Dec 15 '25 16:12 Lohith625

Thank you for the reviews and feedback on this PR.

I’ve cleaned up unrelated changes and addressed the review comments raised so far. This update adds support for anoteparameter to TriggerDagRunOperator, logs the note at trigger time, maintains compatibility across supported Airflow versions, and updates an existing example DAG to demonstrate usage. Relevant unit tests have been updated accordingly.

Please let me know if there are any further changes or adjustments you’d like me to make.

Lohith625 avatar Dec 16 '25 13:12 Lohith625