Skip to content

Clarify variable names and use cleaner set diff syntax#20657

Closed
dstandish wants to merge 1 commit into
apache:mainfrom
astronomer:triggerer-job-renames
Closed

Clarify variable names and use cleaner set diff syntax#20657
dstandish wants to merge 1 commit into
apache:mainfrom
astronomer:triggerer-job-renames

Conversation

@dstandish

Copy link
Copy Markdown
Contributor

The word 'old' could suggest 'triggers we already have' i.e. 'current triggers' as compared with the 'requested' triggers, or with 'triggers we need to create' a.k.a. new triggers. However, here its usage is actually 'triggers we need to remove'. So, updating the variable to use the word 'remove' instead of 'old' is clearer.

Additionally I take the opportunity to use the - operator in place of calling method difference -- I think this results in much better readability.

The word 'old' could mean 'triggers we already have' i.e. 'current triggers' as compared with the 'requested' triggers, or with  'triggers we need to create' a.k.a. new triggers.  However, here its usage is actually 'triggers we need to remove'.  So, updating the variable to use the word 'remove' instead of 'old' is clearer.

Additionally I take the opportunity to use the `-` operator in place of calling method `difference` -- I think this results in much better readability.
@boring-cyborg boring-cyborg Bot added the area:Scheduler including HA (high availability) scheduler label Jan 4, 2022
@github-actions

github-actions Bot commented Jan 5, 2022

Copy link
Copy Markdown
Contributor

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions Bot added the full tests needed We need to run full set of tests for this PR to merge label Jan 5, 2022
new_trigger_ids = requested_trigger_ids.difference(current_trigger_ids)
old_trigger_ids = current_trigger_ids.difference(requested_trigger_ids)
new_trigger_ids = requested_trigger_ids - current_trigger_ids
remove_trigger_ids = current_trigger_ids - requested_trigger_ids

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.

Suggested change
remove_trigger_ids = current_trigger_ids - requested_trigger_ids
trigger_ids_to_remove = current_trigger_ids - requested_trigger_ids

nit -- no strong preference

@uranusjr uranusjr Jan 6, 2022

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.

@dstandish Do you want to change this? Personally I like the ...to_remove name slightly better as well since remove_... sounds like a verb, not a noun. But if you like the current name better, let’s get this merged as-is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah i do agree with the suggestion... but this superceded by other PRs and i will close

thank you for helping to review

@dstandish

Copy link
Copy Markdown
Contributor Author

superceded by #20658 and #20699

@dstandish dstandish closed this Jan 6, 2022
@dstandish dstandish deleted the triggerer-job-renames branch February 14, 2022 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Scheduler including HA (high availability) scheduler full tests needed We need to run full set of tests for this PR to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants