You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2023/08/26 07:18:48 UTC
[airflow] branch main updated: remove unnecessary map and rewrite it using list in Airflow core (#33764)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 4e545c8190 remove unnecessary map and rewrite it using list in Airflow core (#33764)
4e545c8190 is described below
commit 4e545c8190d9e2a085d98c5097b7284099c7cd75
Author: Hussein Awala <hu...@awala.fr>
AuthorDate: Sat Aug 26 09:18:41 2023 +0200
remove unnecessary map and rewrite it using list in Airflow core (#33764)
---
airflow/jobs/backfill_job_runner.py | 2 +-
airflow/utils/dates.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/airflow/jobs/backfill_job_runner.py b/airflow/jobs/backfill_job_runner.py
index f199ce6982..11990e7dde 100644
--- a/airflow/jobs/backfill_job_runner.py
+++ b/airflow/jobs/backfill_job_runner.py
@@ -742,7 +742,7 @@ class BackfillJobRunner(BaseJobRunner[Job], LoggingMixin):
if all(key.map_index == -1 for key in ti_keys):
headers = ["DAG ID", "Task ID", "Run ID", "Try number"]
- sorted_ti_keys = map(lambda k: k[0:4], sorted_ti_keys)
+ sorted_ti_keys = (k[0:4] for k in sorted_ti_keys)
else:
headers = ["DAG ID", "Task ID", "Run ID", "Map Index", "Try number"]
diff --git a/airflow/utils/dates.py b/airflow/utils/dates.py
index c97e99aaba..9351c64e2a 100644
--- a/airflow/utils/dates.py
+++ b/airflow/utils/dates.py
@@ -243,11 +243,11 @@ def infer_time_unit(time_seconds_arr: Collection[float]) -> TimeUnit:
def scale_time_units(time_seconds_arr: Collection[float], unit: TimeUnit) -> Collection[float]:
"""Convert an array of time durations in seconds to the specified time unit."""
if unit == "minutes":
- return list(map(lambda x: x / 60, time_seconds_arr))
+ return [x / 60 for x in time_seconds_arr]
elif unit == "hours":
- return list(map(lambda x: x / (60 * 60), time_seconds_arr))
+ return [x / (60 * 60) for x in time_seconds_arr]
elif unit == "days":
- return list(map(lambda x: x / (24 * 60 * 60), time_seconds_arr))
+ return [x / (24 * 60 * 60) for x in time_seconds_arr]
return time_seconds_arr