Skip to content

Commit

Permalink
remove unnecessary map and rewrite it using list in Airflow core (#33764
Browse files Browse the repository at this point in the history
)
  • Loading branch information
hussein-awala authored Aug 26, 2023
1 parent 784e0ef commit 4e545c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion airflow/jobs/backfill_job_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def tabulate_ti_keys_set(ti_keys: Iterable[TaskInstanceKey]) -> str:

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"]

Expand Down
6 changes: 3 additions & 3 deletions airflow/utils/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 4e545c8

Please sign in to comment.