Make available user who triggered the DAG manually in dag_run.conf
- Dominant language
- Python
- Stars
- 46.9k
- Forks
- 17.8k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 483
Description
### Description
Hello everyone
It should be possible to read out the user name that started a DAG manually.
This user name is required to enter it in the ModifiedBy field during a database update and to display it in the log file for auditing purposes.
If a DAG is started automatically by the scheduler, this field should contain “scheduler”.
Many thanks
### Use case/motivation
The user name is needed for audit purposes.
e.g. triggered_by = context['dag_run'].conf.get('triggered_by', 'unknown')
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
Contributor guide
Research direction
Start by tracing how dag_run.conf and context['dag_run'] are populated for manually triggered and scheduler-created DAG runs. Define coverage for both trigger paths, then verify that the resulting user value is available for audit logging and database updates, with scheduler-triggered runs using the requested fallback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, data-engineering
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100