Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unnecessary map and rewrite it using list in Airflow core #33764

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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