Skip to content

Clean-ups around task-mapping code#26879

Merged
uranusjr merged 1 commit intoapache:mainfrom
astronomer:simplify-expand-mapped-literals
Oct 11, 2022
Merged

Clean-ups around task-mapping code#26879
uranusjr merged 1 commit intoapache:mainfrom
astronomer:simplify-expand-mapped-literals

Conversation

@uranusjr
Copy link
Member

@uranusjr uranusjr commented Oct 5, 2022

I found several places where the code is awkward (although technically correct) and decided to change them. There should be no change in functionality. A few things are involved:

  1. The expand_mapped_literals closure is declaring a sequence argument that is always None. Remove it.
  2. The run_time_mapped_ti_count method is never used in isolation, but combined with parse_time_mapped_ti_count. We should just combine the calls—actually, the run-time variant already covers the parse-time variant, so the latter call can simply be removed.
  3. The TaskInstance import in _revise_mapped_task_indexes is redundant (the class is already imported globally) and is removed.
  4. Various typing fixups.

@uranusjr uranusjr force-pushed the simplify-expand-mapped-literals branch 2 times, most recently from 10eed9c to abe3550 Compare October 5, 2022 16:26
There should be no change in functionality. A few things are involved:

1. The expand_mapped_literals closure is declaring a 'sequence' argument
   that is always None. Remove it.
2. The run_time_mapped_ti_count method is never used in isolation, but
   combined with parse_time_mapped_ti_count. We should just combine the
   calls -- actually, the run-time variant already encompasses the
   parse-time variant, so the latter call can simply be removed.
3. The TaskInstance import in _revise_mapped_task_indexes is redundant
   (the class is already imported globally) and is removed.
4. Various typing fixups.
@uranusjr uranusjr force-pushed the simplify-expand-mapped-literals branch from abe3550 to 38707b4 Compare October 6, 2022 04:49
@uranusjr uranusjr merged commit a2d8724 into apache:main Oct 11, 2022
@uranusjr uranusjr deleted the simplify-expand-mapped-literals branch October 11, 2022 01:32
@ephraimbuddy ephraimbuddy added this to the Airflow 2.4.2 milestone Oct 18, 2022
@ephraimbuddy ephraimbuddy added the type:misc/internal Changelog: Misc changes that should appear in change log label Oct 18, 2022
ephraimbuddy pushed a commit that referenced this pull request Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:misc/internal Changelog: Misc changes that should appear in change log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants