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

ops/main.py: Use CSafeLoader #325

Merged
merged 3 commits into from
Jun 17, 2020
Merged

Conversation

jameinel
Copy link
Member

Testing shows that on a modest yaml file, it can be 2ms instead of 25ms
to load a config.yaml. (postgresql's config.yaml).

By default 'yaml.safe_load' doesn't use the C loader (neither does
yaml.load).

This also unifies the code path that loads YAML for both main.main() and our test suites.

Testing shows that on a modest yaml file, it can be 2ms instead of 25ms
to load a config.yaml. (postgresql's config.yaml).

By default 'yaml.safe_load' doesn't use the C loader (neither does
yaml.load).
Add a Debug level message if yaml doesn't have the C extensions
available.
actions_metadata = None

if not yaml.__with_libyaml__:
logger.debug('yaml does not have libyaml extensions, using slower pure Python yaml loader')
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the point of logging this to the user?

@jameinel
Copy link
Member Author

jameinel commented Jun 15, 2020 via email

Copy link
Contributor

@facundobatista facundobatista left a comment

Choose a reason for hiding this comment

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

Thanks!

Resolve the conflict in main, and include the os import.
@jameinel jameinel merged commit 7fa1165 into canonical:master Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants