Skip to content

Optimize performance of scheduling mapped tasks#30372

Merged
potiuk merged 3 commits into
apache:mainfrom
dzhigimont:optimize_performance_of_scheduling_mapped_tasks
Apr 22, 2023
Merged

Optimize performance of scheduling mapped tasks#30372
potiuk merged 3 commits into
apache:mainfrom
dzhigimont:optimize_performance_of_scheduling_mapped_tasks

Conversation

@dzhigimont

Copy link
Copy Markdown
Contributor

The improvement contains two cases:

  • Update status for ready for scheduling tasks in batches to get rid of the stack depth limit exceeded error when mapped task instances > 4k
  • speed up the scheduling of mapped tasks:
    Calling _revise_map_indexes_if_mapped for each task instance was significantly slowing down the scheduling, but it's enough to call the method only once per task id. The improvement reduced the time for scheduling 10k mapped tasks in my case from 7 - 10 minutes to seconds.
    Closes: expand dynamic mapped tasks in batches #29959.

@dzhigimont

Copy link
Copy Markdown
Contributor Author

FYI @uranusjr

@uranusjr uranusjr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me

Comment thread airflow/models/dagrun.py Outdated
@dzhigimont
dzhigimont force-pushed the optimize_performance_of_scheduling_mapped_tasks branch 4 times, most recently from cd97686 to 06c2350 Compare April 12, 2023 08:12
@dzhigimont
dzhigimont force-pushed the optimize_performance_of_scheduling_mapped_tasks branch from 06c2350 to cba4a08 Compare April 18, 2023 08:01
@potiuk

potiuk commented Apr 18, 2023

Copy link
Copy Markdown
Member

Ah. Sorry missed that one. Yes. it should be fine - same as heartrate, as long as it is Optional. We will figure out the right way of populating it when we get to completing AIP-44 implementation.

@potiuk potiuk closed this Apr 18, 2023
@potiuk potiuk reopened this Apr 18, 2023
@potiuk

potiuk commented Apr 18, 2023

Copy link
Copy Markdown
Member

Closed /reopened to rebuild. There was a problem with GitHub being down during last hour and I think it affected the PR build jobs.

@potiuk
potiuk merged commit ed39b6f into apache:main Apr 22, 2023
@ephraimbuddy ephraimbuddy added the type:improvement Changelog: Improvements label May 8, 2023
@ephraimbuddy ephraimbuddy added this to the Airflow 2.7.0 milestone May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:improvement Changelog: Improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

expand dynamic mapped tasks in batches

4 participants