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

Use libyaml C library when available. #14577

Merged
merged 1 commit into from
Mar 5, 2021

Conversation

ashb
Copy link
Member

@ashb ashb commented Mar 3, 2021

This makes loading local providers (ProvidersManager.initialize_providers_manager()) 1/3 quicker -- from 2s down from 3s on my local SSD.

The airflow.utils.yaml module can be used in place of the normal yaml module, with the bonus that safe_load will use libyaml where available instead of always using the pure python version.

I have not used this module in tests/docs code etc, as I don't want to force importing airflow (and everything in currently brings in) in to those contexts.

@ashb ashb marked this pull request as draft March 3, 2021 11:05
@ashb
Copy link
Member Author

ashb commented Mar 3, 2021

Whoops wrong commit. I'm chaning this to use cyaml everywhere.

@ashb ashb marked this pull request as ready for review March 3, 2021 11:26
@github-actions
Copy link

github-actions bot commented Mar 3, 2021

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 master 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 Mar 3, 2021
@ashb
Copy link
Member Author

ashb commented Mar 3, 2021

Oh, To make new providers work with 2.0.0 I'm going to have to do

try:
    import airflow.utils.yaml as yaml
except ImportError:
    import yaml

Ugh.

(Judos to @potiuk for writing tests for this exact case!)

This makes loading local providers 1/3 quicker -- from 2s down from 3s
on my local SSD.

The `airflow.utils.yaml` module can be used in place of the normal yaml
module, with the bonus that `safe_load` will use libyaml where available
instead of always using the pure python version.

I have not used this module in tests/docs code etc, as I don't want to
force importing `airflow` (and everything in currently brings in) in to
those contexts.
@ashb
Copy link
Member Author

ashb commented Mar 5, 2021

I think this shaves 3 minutes of the "WWW" tests - down to 8 minutes from 11 minutes, and about 6 minutes overall runtime (58mins for Py3.6 sqlite job, down to 52 -- still too high but this is an easy fix.

@ashb ashb merged commit 7daebef into apache:master Mar 5, 2021
@ashb ashb deleted the use-cyaml-if-available branch March 5, 2021 10:17
@ashb ashb added this to the Airflow 2.0.2 milestone Mar 19, 2021
ashb added a commit that referenced this pull request Mar 19, 2021
This makes loading local providers 1/3 quicker -- from 2s down from 3s
on my local SSD.

The `airflow.utils.yaml` module can be used in place of the normal yaml
module, with the bonus that `safe_load` will use libyaml where available
instead of always using the pure python version.

This shaves 3 minutes off the "WWW" tests - down to 8 minutes from
11 minutes.

I have not used this module in tests/docs code etc, as I don't want to
force importing `airflow` (and everything in currently brings in) in to
those contexts.

(cherry picked from commit 7daebef)
ashb added a commit that referenced this pull request Apr 15, 2021
This makes loading local providers 1/3 quicker -- from 2s down from 3s
on my local SSD.

The `airflow.utils.yaml` module can be used in place of the normal yaml
module, with the bonus that `safe_load` will use libyaml where available
instead of always using the pure python version.

This shaves 3 minutes off the "WWW" tests - down to 8 minutes from
11 minutes.

I have not used this module in tests/docs code etc, as I don't want to
force importing `airflow` (and everything in currently brings in) in to
those contexts.

(cherry picked from commit 7daebef)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants