Fix GlueJobHook failing to update a Glue job that has tags#68711
Open
FrankYang0529 wants to merge 1 commit into
Open
Fix GlueJobHook failing to update a Glue job that has tags#68711FrankYang0529 wants to merge 1 commit into
FrankYang0529 wants to merge 1 commit into
Conversation
Signed-off-by: PoAn Yang <payang@apache.org>
2 tasks
Lee-W
approved these changes
Jun 18, 2026
Comment on lines
+522
to
+530
| tags_to_add = {key: value for key, value in job_tags.items() if current_tags.get(key) != value} | ||
| tags_to_remove = [key for key in current_tags if key not in job_tags] | ||
|
|
||
| if tags_to_add: | ||
| self.log.info("Updating job tags: %s", job_name) | ||
| self.conn.tag_resource(ResourceArn=job_arn, TagsToAdd=tags_to_add) | ||
| if tags_to_remove: | ||
| self.log.info("Removing job tags: %s", job_name) | ||
| self.conn.untag_resource(ResourceArn=job_arn, TagsToRemove=tags_to_remove) |
Member
There was a problem hiding this comment.
Suggested change
| tags_to_add = {key: value for key, value in job_tags.items() if current_tags.get(key) != value} | |
| tags_to_remove = [key for key in current_tags if key not in job_tags] | |
| if tags_to_add: | |
| self.log.info("Updating job tags: %s", job_name) | |
| self.conn.tag_resource(ResourceArn=job_arn, TagsToAdd=tags_to_add) | |
| if tags_to_remove: | |
| self.log.info("Removing job tags: %s", job_name) | |
| self.conn.untag_resource(ResourceArn=job_arn, TagsToRemove=tags_to_remove) | |
| if (tags_to_add := {key: value for key, value in job_tags.items() if current_tags.get(key) != value}) | |
| self.log.info("Updating job tags: %s", job_name) | |
| self.conn.tag_resource(ResourceArn=job_arn, TagsToAdd=tags_to_add) | |
| if (tags_to_remove := [key for key in current_tags if key not in job_tags]) | |
| self.log.info("Removing job tags: %s", job_name) | |
| self.conn.untag_resource(ResourceArn=job_arn, TagsToRemove=tags_to_remove) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
GlueJobOperator/GlueJobHookruns withupdate_config=Trueagainst a job that already exists and whosecreate_job_kwargsincludeTags, the update fails.AWS Glue's
CreateJobaccepts a top-level
Tagsparameter, butUpdateJobonly acceptsJobNameand aJobUpdatestructure. The hook passed the whole config (includingTags) straight intoJobUpdate, so botocore rejected the call with aParamValidationError. The result was an inconsistency: tagging a job worked on first creation but broke on every subsequent update.This strips
Tagsout of theJobUpdatepayload and reconciles them through the dedicated tag APIs (TagResource/UntagResource), mirroring howGlueCrawlerHookalready handles the same Glue limitation for crawlers. Tag additions, value changes, and removals are all applied. Theupdate_jobnow reports that an update happened, when only the tags change.closes: #68676
Was generative AI tooling used to co-author this PR?
Generated-by: [Claude Code with Opus 4.8] following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.