Skip to content

Conversation

@luos-fc
Copy link
Contributor

@luos-fc luos-fc commented Jul 3, 2023

Closes: #32330

This PR modifies the GlueCrawlerHook to only update the crawlers tags if the Tags key is present in the config dict. This prevent situations where tags that are set by external processes are overwritten whenever the crawler is run from Airflow.

@luos-fc luos-fc requested review from eladkal and o-nikolas as code owners July 3, 2023 14:35
@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Jul 3, 2023
Copy link
Contributor

@Adaverse Adaverse left a comment

Choose a reason for hiding this comment

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

The changes and corresponding test coverage LGTM.

mock_config_missing_tags.pop("Tags")
mock_get_conn.return_value.get_crawler.return_value = {"Crawler": mock_config_missing_tags}

assert self.hook.update_crawler(**mock_config_missing_tags) is False
Copy link
Contributor

@utkarsharma2 utkarsharma2 Jul 4, 2023

Choose a reason for hiding this comment

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

Should we also add a testcase for when Tags key is in the config? Not sure if it's already covered.

Copy link
Contributor

Choose a reason for hiding this comment

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

i think test_replace_tag function is testing the above case.

Copy link
Member

Choose a reason for hiding this comment

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

yeah. Can you double check it @utkarsharma2 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ya, they are covered. I got confused by these lines, it seems like they don't add any value to the test. Test seems to work even after removing them.

mock_config_two = deepcopy(mock_config)
mock_config_two.pop("Tags")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed those two lines

@Adaverse
Copy link
Contributor

Adaverse commented Jul 4, 2023

Can we also do this cleanup i.e in test test_replace_tag, it seems like the below code snippet is just laying there -

        mock_config_two = deepcopy(mock_config)
        mock_config_two.pop("Tags")

@potiuk
Copy link
Member

potiuk commented Jul 4, 2023

Can we also do this cleanup i.e in test test_replace_tag, it seems like the below code snippet is just lying there -

        mock_config_two = deepcopy(mock_config)
        mock_config_two.pop("Tags")

what do you mean by lying :) ?

@Adaverse
Copy link
Contributor

Adaverse commented Jul 4, 2023

Can we also do this cleanup i.e in test test_replace_tag, it seems like the below code snippet is just lying there -

        mock_config_two = deepcopy(mock_config)
        mock_config_two.pop("Tags")

what do you mean by lying :) ?

The variable mock_config_two isn't being used just defined. Pardon for the typo lying :).

@luos-fc luos-fc requested review from Adaverse and utkarsharma2 July 6, 2023 09:14
Copy link
Contributor

@Adaverse Adaverse left a comment

Choose a reason for hiding this comment

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

LGTM

@potiuk potiuk merged commit 7a3bc8d into apache:main Jul 6, 2023
@luos-fc luos-fc deleted the glue-tags branch July 6, 2023 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWS GlueCrawlerOperator deletes existing tags on run

5 participants