jason810496 commented on code in PR #51738:
URL: https://github.com/apache/airflow/pull/51738#discussion_r2164319969
##########
airflow-core/src/airflow/cli/commands/backfill_command.py:
##########
@@ -70,12 +74,18 @@ def create_backfill(args) -> None:
console.print(f" - {d}")
return
+ try:
+ user = getuser()
+ except AirflowConfigException as e:
+ log.warning("Failed to get user name from os: %s", e)
+ user = None
Review Comment:
Should we modularize the this try-except block for getting user from
platform, as this utility will be reused in `assets`, `backfills`, `dag_run`,
`task`.
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py:
##########
@@ -381,6 +383,7 @@ def materialize_asset(
run_after=run_after,
run_type=DagRunType.MANUAL,
triggered_by=DagRunTriggeredByType.REST_API,
+ triggering_user=user.get_name(),
Review Comment:
I think using `get_name` should be fine, which also align the current audit
log behavior.
Since the `action_logging` decorator used in core-api also use the
`user.get_name()` to record in the `Log` table.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]