Uh oh!
There was an error while loading. Please reload this page.
Improve caching strategy across the board of CI workflow - #45289
Conversation
349e55b to
b3fc69bComparepotiuk
commented
Dec 30, 2024
Looks like the stash action does not work exactly as advertised :) |
gopidesupavan
commented
Dec 30, 2024
think we need to set env variable name |
gopidesupavan
commented
Dec 30, 2024
ah head_name is derived from github ref. |
Yeah - it seems that the action likely gets into a race condition, or does not work as advertised: From: https://github.com/apache/infrastructure-actions/tree/main/stash#usage
It seems that we have error 409 conflict not handled (I tried with both override 'false' - there it fails obviously) and default
CC: @assignUser - is the right guess ? |
potiuk
commented
Dec 30, 2024
potiuk
commented
Dec 30, 2024
If that's the right guess, then we might try to handle it somehow - since we don't care which uploaded artifact will be uploaded - we can actually even ignore 409 when it happens - without retrying it because it means that someone else managed to upload the artifact in parallel and they "won". |
potiuk
commented
Dec 30, 2024
cc: @assignUser - seems we are stressing your action to the limit :) |
assignUser
commented
Dec 30, 2024
Wow that's wild, haven't seen that before :D But that's an issue with the artifact backend, nothing really I can change in the action itself. |
potiuk
commented
Dec 30, 2024
Let's see... PRs might be coming :) |
potiuk
commented
Dec 30, 2024
FYI. @assignUser and @gopidesupavan -> seems that this is a well known "feature" of the This is even explained here: https://github.com/actions/download-artifact/blob/main/docs/MIGRATION.md#multiple-uploads-to-the-same-named-artifact as solution. Example solution: actions/upload-artifact#478 (comment) But stash does not use the download-artitact action and "merge-multiple" ... And I really do not like the "solution". .. So we wil have to come up with a different approach. |
potiuk
commented
Dec 30, 2024
OK. @assignUser and @gopidesupavan -> I think I found a solution (and actually this is a better one in general for performance, but slightly more "distributed" among the .yml files. Instead of heaving a clear save/restore around installation, I only do:
And I make sure to have one separate job that is prerequisite of all other jobs ( This way we get a little longer bootstrap, but then all the other jobs should use the cache uploaded by the prerequisite job. Plus the bootstrap will also use the artifact from previous runs (or target branch) if corresponding pyproject.toml / pre-commit config files did not change. |
10f19da to
ed286c5Comparepotiuk
commented
Dec 31, 2024
Nice. 1m35 s -> 30s for pre-commit environment. |
bd210d4 to
1aa9d07CompareWe are using various caches in our build and so far - due to the way how "standard" caching works, PRs from forks could not effectively use the cache from main Airflow repository - because caches are not shared with other repositories - so the PRs builds could only use cache effectively when they were rebased and continued running from the same fork. This PR improves caching strategy using "stash" action from the ASF. Unlike `cache` - the action uses artifacts to store cache, and that makes it possible for the stash action to use such cache uploaded from `main` canary builds in PRs coming from the fork. As part of this change all the places where setup-python was used and breeze installed afterwards were reviewed and updated to use only breeze installation action (it already installs python) and this action has been improved to use UV caching effectively. Overall this PR should decrease setup overhead for many jobs across the CI workflow. Follow-up after apache#45266
There are a few improvements just merged in the latest version of the "stash" suite of actions that we contributed. Most of the changes were result of making the apache#45289 works with stash action and since the changes were added we found that we need to do things differently (for example rather than storing .cache directly we need to tar the directories because we need to preserve permissions and symbolic links). There is however one useful feature that remained - namely protecting against accidentally downloading stash from the main branch, when the PR needs only "its own" artifact (helpful in case of typos in the workflow where wrong image artifact name is specified). This PR switches to latest version of the action and enables the protection in "prepare images" composite actions.
…45653) There are a few improvements just merged in the latest version of the "stash" suite of actions that we contributed. Most of the changes were result of making the #45289 works with stash action and since the changes were added we found that we need to do things differently (for example rather than storing .cache directly we need to tar the directories because we need to preserve permissions and symbolic links). There is however one useful feature that remained - namely protecting against accidentally downloading stash from the main branch, when the PR needs only "its own" artifact (helpful in case of typos in the workflow where wrong image artifact name is specified). This PR switches to latest version of the action and enables the protection in "prepare images" composite actions.
We are using various caches in our build and so far - due to the way how "standard" caching works, PRs from forks could not effectively use the cache from main Airflow repository - because caches are not shared with other repositories - so the PRs builds could only use cache effectively when they were rebased and continued running from the same fork. This PR improves caching strategy using "stash" action from the ASF. Unlike `cache` - the action uses artifacts to store cache, and that makes it possible for the stash action to use such cache uploaded from `main` canary builds in PRs coming from the fork. As part of this change all the places where setup-python was used and breeze installed afterwards were reviewed and updated to use only breeze installation action (it already installs python) and this action has been improved to use UV caching effectively. Overall this PR should decrease setup overhead for many jobs across the CI workflow. Follow-up after apache#45266
…pache#45653) There are a few improvements just merged in the latest version of the "stash" suite of actions that we contributed. Most of the changes were result of making the apache#45289 works with stash action and since the changes were added we found that we need to do things differently (for example rather than storing .cache directly we need to tar the directories because we need to preserve permissions and symbolic links). There is however one useful feature that remained - namely protecting against accidentally downloading stash from the main branch, when the PR needs only "its own" artifact (helpful in case of typos in the workflow where wrong image artifact name is specified). This PR switches to latest version of the action and enables the protection in "prepare images" composite actions.
…pache#45653) There are a few improvements just merged in the latest version of the "stash" suite of actions that we contributed. Most of the changes were result of making the apache#45289 works with stash action and since the changes were added we found that we need to do things differently (for example rather than storing .cache directly we need to tar the directories because we need to preserve permissions and symbolic links). There is however one useful feature that remained - namely protecting against accidentally downloading stash from the main branch, when the PR needs only "its own" artifact (helpful in case of typos in the workflow where wrong image artifact name is specified). This PR switches to latest version of the action and enables the protection in "prepare images" composite actions.
We are using various caches in our build and so far - due to the way how "standard" caching works, PRs from forks could not effectively use the cache from main Airflow repository - because caches are not shared with other repositories - so the PRs builds could only use cache effectively when they were rebased and continued running from the same fork. This PR improves caching strategy using "stash" action from the ASF. Unlike `cache` - the action uses artifacts to store cache, and that makes it possible for the stash action to use such cache uploaded from `main` canary builds in PRs coming from the fork. As part of this change all the places where setup-python was used and breeze installed afterwards were reviewed and updated to use only breeze installation action (it already installs python) and this action has been improved to use UV caching effectively. Overall this PR should decrease setup overhead for many jobs across the CI workflow. Follow-up after apache#45266
…pache#45653) There are a few improvements just merged in the latest version of the "stash" suite of actions that we contributed. Most of the changes were result of making the apache#45289 works with stash action and since the changes were added we found that we need to do things differently (for example rather than storing .cache directly we need to tar the directories because we need to preserve permissions and symbolic links). There is however one useful feature that remained - namely protecting against accidentally downloading stash from the main branch, when the PR needs only "its own" artifact (helpful in case of typos in the workflow where wrong image artifact name is specified). This PR switches to latest version of the action and enables the protection in "prepare images" composite actions.

We are using various caches in our build and so far - due to the way how "standard" caching works, PRs from forks could not effectively use the cache from main Airflow repository - because caches are not shared with other repositories - so the PRs builds could only use cache effectively when they were rebased and continued running from the same fork.
This PR improves caching strategy using "stash" action from the ASF. Unlike
cache- the action uses artifacts to store cache, and that makes it possible for the stash action to use such cache uploaded frommaincanary builds in PRs coming from the fork.As part of this change all the places where setup-python was used and breeze installed afterwards were reviewed and updated to use only breeze installation action (it already installs python) and this action has been improved to use UV caching effectively.
Overall this PR should decrease setup overhead for many jobs across the CI workflow.
Follow-up after #45266
^ 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.rstor{issue_number}.significant.rst, in newsfragments.