From acb1a100bbf889dddef1702c95bd7262a578dfcc Mon Sep 17 00:00:00 2001 From: Kosteev Eugene Date: Fri, 25 Mar 2022 11:40:51 +0200 Subject: [PATCH] Use logger to print message during task execution. (#22488) --- airflow/cli/commands/task_command.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/airflow/cli/commands/task_command.py b/airflow/cli/commands/task_command.py index 6c03edc3c3a51..5387f6b05feba 100644 --- a/airflow/cli/commands/task_command.py +++ b/airflow/cli/commands/task_command.py @@ -56,6 +56,8 @@ from airflow.utils.session import NEW_SESSION, create_session, provide_session from airflow.utils.state import DagRunState +log = logging.getLogger(__name__) + CreateIfNecessary = Union[Literal[False], Literal["db"], Literal["memory"]] @@ -364,7 +366,7 @@ def task_run(args, dag=None): hostname = get_hostname() - print(f"Running {ti} on host {hostname}") + log.info("Running %s on host %s", ti, hostname) if args.interactive: _run_task_by_selected_method(args, dag, ti)