Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearer code for PodGenerator.deserialize_model_file #26641

Merged
merged 2 commits into from
Sep 26, 2022

Conversation

XD-DENG
Copy link
Member

@XD-DENG XD-DENG commented Sep 23, 2022

Especially for how it handles non-existent file.

When the file path received doesn't exist, the current way is to use yaml.safe_load() to process it, and it returns the path as a string.

Then this string is passed to deserialize_model_dict() and results in an empty object. Passing 'None' to deserialize_model_dict() will do the same, but the code will become clearer, and less misleading.

Meanwhile, when the model file path received doesn't exist, there should be a warning in the log.

(This change shouldn't cause any behaviour change)


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added the provider:cncf-kubernetes Kubernetes provider related issues label Sep 23, 2022
@XD-DENG XD-DENG force-pushed the improve-model-deserialize branch 2 times, most recently from 89979fe to 70499c6 Compare September 23, 2022 19:48
@XD-DENG XD-DENG marked this pull request as draft September 23, 2022 21:24
@XD-DENG XD-DENG force-pushed the improve-model-deserialize branch 4 times, most recently from f77daa7 to 9ee336d Compare September 25, 2022 20:10
Especially for how it handles non-existent file.

When the file path received doesn't exist, the current way is to use yaml.safe_load()
to process it, and it returns the path as a string.

Then this string is passed to deserialize_model_dict() and results in an empty object.
Passing 'None' to deserialize_model_dict() will do the same, but the code will become clearer, and less misleading.

Meanwhile, when the model file path received doesn't exist, there should be a warning in the log.

(This change shouldn't cause any behaviour change)
@XD-DENG XD-DENG marked this pull request as ready for review September 25, 2022 21:50
@XD-DENG XD-DENG requested a review from ashb September 25, 2022 21:51
@XD-DENG
Copy link
Member Author

XD-DENG commented Sep 25, 2022

Hi @ashb , adding you as reviewer for this since you reviewed & co-authored the original change.

Pls let me know if this is making sense to you or additional info needed. Thanks!

@XD-DENG XD-DENG merged commit 35deda4 into apache:main Sep 26, 2022
@XD-DENG XD-DENG deleted the improve-model-deserialize branch September 26, 2022 07:59
@XD-DENG XD-DENG added this to the Airflow 2.4.1 milestone Sep 26, 2022
@jedcunningham jedcunningham removed this from the Airflow 2.4.1 milestone Sep 26, 2022
@ephraimbuddy ephraimbuddy added this to the Airflow 2.5.0 milestone Oct 18, 2022
@ephraimbuddy ephraimbuddy added the type:improvement Changelog: Improvements label Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider:cncf-kubernetes Kubernetes provider related issues type:improvement Changelog: Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants