From e226d385ad5f7739fa3759ef1558bc517e748638 Mon Sep 17 00:00:00 2001 From: Kaxil Naik Date: Mon, 4 Nov 2024 21:45:37 +0000 Subject: [PATCH] Replace subtask references Follow-up of https://github.com/apache/airflow/pull/43599, specifically https://github.com/apache/airflow/pull/43599/files#r1826351853 from @dstandish. --- airflow/task/standard_task_runner.py | 2 +- tests/cli/commands/test_task_command.py | 2 +- tests/utils/test_log_handlers.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/airflow/task/standard_task_runner.py b/airflow/task/standard_task_runner.py index a5641002c961c..ab5bdc0f20645 100644 --- a/airflow/task/standard_task_runner.py +++ b/airflow/task/standard_task_runner.py @@ -159,7 +159,7 @@ def _start_by_fork(self): args = parser.parse_args(self._command[1:]) self.log.info("Running: %s", self._command) - self.log.info("Subtask %s", self._task_instance.task_id) + self.log.info("Task %s", self._task_instance.task_id) proc_title = "airflow task runner: {0.dag_id} {0.task_id} {0.execution_date_or_run_id}" setproctitle(proc_title.format(args)) diff --git a/tests/cli/commands/test_task_command.py b/tests/cli/commands/test_task_command.py index 5a4e0b279242e..ad1e8b0ede9ee 100644 --- a/tests/cli/commands/test_task_command.py +++ b/tests/cli/commands/test_task_command.py @@ -885,7 +885,7 @@ def test_logging_with_run_task(self, session): logs_list = logs.splitlines() assert "INFO - Started process" in logs - assert f"Subtask {self.task_id}" in logs + assert f"Task {self.task_id}" in logs assert "standard_task_runner.py" in logs assert ( f"INFO - Running: ['airflow', 'tasks', 'run', '{self.dag_id}', " diff --git a/tests/utils/test_log_handlers.py b/tests/utils/test_log_handlers.py index 781e3d853308d..dfcb020c100c7 100644 --- a/tests/utils/test_log_handlers.py +++ b/tests/utils/test_log_handlers.py @@ -538,7 +538,7 @@ def test_log_retrieval_valid_trigger(self, create_task_instance): [2022-11-16T00:05:54.300-0800] {standard_task_runner.py:55} INFO - Started process 52536 to run task [2022-11-16T00:05:54.300-0800] {standard_task_runner.py:55} INFO - Started process 52536 to run task [2022-11-16T00:05:54.306-0800] {standard_task_runner.py:82} INFO - Running: ['airflow', 'tasks', 'run', 'simple_async_timedelta', 'wait', 'manual__2022-11-16T08:05:52.324532+00:00', '--job-id', '33648', '--raw', '--subdir', '/Users/dstandish/code/airflow/airflow/example_dags/example_time_delta_sensor_async.py', '--cfg-path', '/var/folders/7_/1xx0hqcs3txd7kqt0ngfdjth0000gn/T/tmp725r305n'] -[2022-11-16T00:05:54.309-0800] {standard_task_runner.py:83} INFO - Job 33648: Subtask wait +[2022-11-16T00:05:54.309-0800] {standard_task_runner.py:83} INFO - Task wait [2022-11-16T00:05:54.457-0800] {task_command.py:376} INFO - Running on host daniels-mbp-2.lan [2022-11-16T00:05:54.592-0800] {taskinstance.py:1485} INFO - Exporting the following env vars: AIRFLOW_CTX_DAG_OWNER=airflow @@ -592,7 +592,7 @@ def test_interleave_interleaves(): "[2022-11-16T00:05:54.300-0800] {standard_task_runner.py:55} INFO - Started process 52536 to run task", "[2022-11-16T00:05:54.300-0800] {standard_task_runner.py:55} INFO - Started process 52536 to run task", "[2022-11-16T00:05:54.306-0800] {standard_task_runner.py:82} INFO - Running: ['airflow', 'tasks', 'run', 'simple_async_timedelta', 'wait', 'manual__2022-11-16T08:05:52.324532+00:00', '--job-id', '33648', '--raw', '--subdir', '/Users/dstandish/code/airflow/airflow/example_dags/example_time_delta_sensor_async.py', '--cfg-path', '/var/folders/7_/1xx0hqcs3txd7kqt0ngfdjth0000gn/T/tmp725r305n']", - "[2022-11-16T00:05:54.309-0800] {standard_task_runner.py:83} INFO - Job 33648: Subtask wait", + "[2022-11-16T00:05:54.309-0800] {standard_task_runner.py:83} INFO - Task wait", ] ) log_sample3 = "\n".join( @@ -613,7 +613,7 @@ def test_interleave_interleaves(): "[2022-11-16T00:05:54.295-0800] {taskinstance.py:1278} INFO - Executing on 2022-11-16 08:05:52.324532+00:00", "[2022-11-16T00:05:54.300-0800] {standard_task_runner.py:55} INFO - Started process 52536 to run task", "[2022-11-16T00:05:54.306-0800] {standard_task_runner.py:82} INFO - Running: ['airflow', 'tasks', 'run', 'simple_async_timedelta', 'wait', 'manual__2022-11-16T08:05:52.324532+00:00', '--job-id', '33648', '--raw', '--subdir', '/Users/dstandish/code/airflow/airflow/example_dags/example_time_delta_sensor_async.py', '--cfg-path', '/var/folders/7_/1xx0hqcs3txd7kqt0ngfdjth0000gn/T/tmp725r305n']", - "[2022-11-16T00:05:54.309-0800] {standard_task_runner.py:83} INFO - Job 33648: Subtask wait", + "[2022-11-16T00:05:54.309-0800] {standard_task_runner.py:83} INFO - Task wait", "[2022-11-16T00:05:54.457-0800] {task_command.py:376} INFO - Running on host daniels-mbp-2.lan", "[2022-11-16T00:05:54.592-0800] {taskinstance.py:1485} INFO - Exporting env vars: AIRFLOW_CTX_DAG_OWNER=airflow", "AIRFLOW_CTX_DAG_ID=simple_async_timedelta", @@ -635,7 +635,7 @@ def test_interleave_interleaves(): [2023-01-15T22:36:46.516-0800] {taskinstance.py:1351} INFO - Executing on 2023-01-16 06:36:43.044492+00:00 [2023-01-15T22:36:46.522-0800] {standard_task_runner.py:56} INFO - Started process 38807 to run task [2023-01-15T22:36:46.530-0800] {standard_task_runner.py:83} INFO - Running: ['airflow', 'tasks', 'run', 'example_time_delta_sensor_async', 'wait', 'manual__2023-01-16T06:36:43.044492+00:00', '--job-id', '487', '--raw', '--subdir', '/Users/dstandish/code/airflow/airflow/example_dags/example_time_delta_sensor_async.py', '--cfg-path', '/var/folders/7_/1xx0hqcs3txd7kqt0ngfdjth0000gn/T/tmpiwyl54bn', '--no-shut-down-logging'] -[2023-01-15T22:36:46.536-0800] {standard_task_runner.py:84} INFO - Job 487: Subtask wait +[2023-01-15T22:36:46.536-0800] {standard_task_runner.py:84} INFO - Task wait [2023-01-15T22:36:46.624-0800] {task_command.py:417} INFO - Running on host daniels-mbp-2.lan [2023-01-15T22:36:46.918-0800] {taskinstance.py:1558} INFO - Exporting env vars: AIRFLOW_CTX_DAG_OWNER='airflow' AIRFLOW_CTX_DAG_ID='example_time_delta_sensor_async' AIRFLOW_CTX_TASK_ID='wait' AIRFLOW_CTX_EXECUTION_DATE='2023-01-16T06:36:43.044492+00:00' AIRFLOW_CTX_TRY_NUMBER='1' AIRFLOW_CTX_DAG_RUN_ID='manual__2023-01-16T06:36:43.044492+00:00' [2023-01-15T22:36:46.929-0800] {taskinstance.py:1433} INFO - Pausing task as DEFERRED. dag_id=example_time_delta_sensor_async, task_id=wait, execution_date=20230116T063643, start_date=20230116T063646 @@ -647,7 +647,7 @@ def test_interleave_interleaves(): [2023-01-15T22:36:46.516-0800] {taskinstance.py:1351} INFO - Executing on 2023-01-16 06:36:43.044492+00:00 [2023-01-15T22:36:46.522-0800] {standard_task_runner.py:56} INFO - Started process 38807 to run task [2023-01-15T22:36:46.530-0800] {standard_task_runner.py:83} INFO - Running: ['airflow', 'tasks', 'run', 'example_time_delta_sensor_async', 'wait', 'manual__2023-01-16T06:36:43.044492+00:00', '--job-id', '487', '--raw', '--subdir', '/Users/dstandish/code/airflow/airflow/example_dags/example_time_delta_sensor_async.py', '--cfg-path', '/var/folders/7_/1xx0hqcs3txd7kqt0ngfdjth0000gn/T/tmpiwyl54bn', '--no-shut-down-logging'] -[2023-01-15T22:36:46.536-0800] {standard_task_runner.py:84} INFO - Job 487: Subtask wait +[2023-01-15T22:36:46.536-0800] {standard_task_runner.py:84} INFO - Task wait [2023-01-15T22:36:46.624-0800] {task_command.py:417} INFO - Running on host daniels-mbp-2.lan [2023-01-15T22:36:46.918-0800] {taskinstance.py:1558} INFO - Exporting env vars: AIRFLOW_CTX_DAG_OWNER='airflow' AIRFLOW_CTX_DAG_ID='example_time_delta_sensor_async' AIRFLOW_CTX_TASK_ID='wait' AIRFLOW_CTX_EXECUTION_DATE='2023-01-16T06:36:43.044492+00:00' AIRFLOW_CTX_TRY_NUMBER='1' AIRFLOW_CTX_DAG_RUN_ID='manual__2023-01-16T06:36:43.044492+00:00' [2023-01-15T22:36:46.929-0800] {taskinstance.py:1433} INFO - Pausing task as DEFERRED. dag_id=example_time_delta_sensor_async, task_id=wait, execution_date=20230116T063643, start_date=20230116T063646 @@ -658,7 +658,7 @@ def test_interleave_interleaves(): [2023-01-15T22:37:17.693-0800] {taskinstance.py:1351} INFO - Executing on 2023-01-16 06:36:43.044492+00:00 [2023-01-15T22:37:17.697-0800] {standard_task_runner.py:56} INFO - Started process 39090 to run task [2023-01-15T22:37:17.703-0800] {standard_task_runner.py:83} INFO - Running: ['airflow', 'tasks', 'run', 'example_time_delta_sensor_async', 'wait', 'manual__2023-01-16T06:36:43.044492+00:00', '--job-id', '488', '--raw', '--subdir', '/Users/dstandish/code/airflow/airflow/example_dags/example_time_delta_sensor_async.py', '--cfg-path', '/var/folders/7_/1xx0hqcs3txd7kqt0ngfdjth0000gn/T/tmp_sa9sau4', '--no-shut-down-logging'] -[2023-01-15T22:37:17.707-0800] {standard_task_runner.py:84} INFO - Job 488: Subtask wait +[2023-01-15T22:37:17.707-0800] {standard_task_runner.py:84} INFO - Task wait [2023-01-15T22:37:17.771-0800] {task_command.py:417} INFO - Running on host daniels-mbp-2.lan [2023-01-15T22:37:18.043-0800] {taskinstance.py:1369} INFO - Marking task as SUCCESS. dag_id=example_time_delta_sensor_async, task_id=wait, execution_date=20230116T063643, start_date=20230116T063646, end_date=20230116T063718 [2023-01-15T22:37:18.117-0800] {local_task_job.py:220} INFO - Task exited with return code 0