Skip to content

Conversation

@potiuk
Copy link
Member

@potiuk potiuk commented Oct 18, 2023

So far, we regenerated the constraints in order to get them updated in constraint branches at the end of the CI build when we knew all the builds succeded. However this was not perfect for two reasons:

  • there was a race condition that a dependency had been released between the time images were built and tests completed. While it had no impact on "source" constraints (they reflect what is in the image), it could change the PyPI constraints generated or "no-providers" constraints, because they use "current" set of dependencies in PyPI to generate them.

  • generating constraints (for PyPI and "no-providers") takes time because pip has to resolve dependencies again - taking into account what is in the PyPI registry, and this can take a long time (minutes or even it can lead to long pip backtracking. We generally cancel running builds when new commit is merged in main, so this could lead to such constraint job being canceled by subsequent merge

This PR uses the fact that we have now "preview-constraints" job that uploads constraints as artifacts in CI workflow, and instead of regenerating the constraints, we can download the constraints from uploaded artifact and use it - this is very quick and we can also make a clear dependency between "preview" and "update" constraints jobs - making it clear in case of PIP backtracking that we have problem with constraints, not with the image. This will make it far clearer when we will have problems with constraints and backtracking that this is the real issue we have (allowing such PRs to get merged while constraints backtracking problem is being worked on.


^ 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.

@potiuk
Copy link
Member Author

potiuk commented Oct 18, 2023

"Final" improvement to constraint generation process -> making it more robust and faster and clearer in case pip starts backtracking on constraints generation.

@potiuk potiuk requested a review from uranusjr October 18, 2023 11:26
@potiuk potiuk force-pushed the faster-and-more-robust-constraint-update branch from 864ec4b to 0b8d985 Compare October 18, 2023 11:27
Copy link
Member Author

Choose a reason for hiding this comment

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

It's also faster as we do not need to install breeze/pull image since we are using constraints generated earlier and download them from artifacts

@potiuk potiuk force-pushed the faster-and-more-robust-constraint-update branch 4 times, most recently from e6fea01 to d7ef1e7 Compare October 18, 2023 13:03
@potiuk potiuk force-pushed the faster-and-more-robust-constraint-update branch from d7ef1e7 to 5fa3512 Compare October 18, 2023 13:36
So far, we regenerated the constraints in order to get them
updated in constraint branches at the end of the CI build when we
knew all the builds succeded. However this was not perfect for
two reasons:

* there was a race condition that a dependency had been released
  between the time images were built and tests completed. While
  it had no impact on "source" constraints (they reflect what is
  in the image), it could change the PyPI constraints generated
  or "no-providers" constraints, because they use "current" set
  of dependencies in PyPI to generate them.

* generating constraints (for PyPI and "no-providers") takes time
  because `pip` has to resolve dependencies again - taking into
  account what is in the PyPI registry, and this can take a long
  time (minutes or even it can lead to long `pip` backtracking.
  We generally cancel running builds when new commit is merged in
  main, so this could lead to such constraint job being canceled
  by subsequent merge

This PR uses the fact that we have now "preview-constraints" job
that uploads constraints as artifacts in CI workflow, and instead
of regenerating the constraints, we can download the constraints
from uploaded artifact and use it - this is very quick and we can
also make a clear dependency between "preview" and "update"
constraints jobs - making it clear in case of PIP backtracking
that we have problem with constraints, not with the image. This
will make it far clearer when we will have problems with constraints
and backtracking that this is the real issue we have (allowing
such PRs to get merged while constraints backtracking problem is
being worked on.
@potiuk potiuk force-pushed the faster-and-more-robust-constraint-update branch from 5fa3512 to bad3806 Compare October 18, 2023 13:39
@potiuk potiuk merged commit f115ec1 into apache:main Oct 18, 2023
@potiuk potiuk deleted the faster-and-more-robust-constraint-update branch October 18, 2023 14:08
@ephraimbuddy ephraimbuddy added this to the Airflow 2.7.3 milestone Oct 27, 2023
@ephraimbuddy ephraimbuddy added the changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) label Oct 27, 2023
potiuk added a commit that referenced this pull request Oct 29, 2023
)

So far, we regenerated the constraints in order to get them
updated in constraint branches at the end of the CI build when we
knew all the builds succeded. However this was not perfect for
two reasons:

* there was a race condition that a dependency had been released
  between the time images were built and tests completed. While
  it had no impact on "source" constraints (they reflect what is
  in the image), it could change the PyPI constraints generated
  or "no-providers" constraints, because they use "current" set
  of dependencies in PyPI to generate them.

* generating constraints (for PyPI and "no-providers") takes time
  because `pip` has to resolve dependencies again - taking into
  account what is in the PyPI registry, and this can take a long
  time (minutes or even it can lead to long `pip` backtracking.
  We generally cancel running builds when new commit is merged in
  main, so this could lead to such constraint job being canceled
  by subsequent merge

This PR uses the fact that we have now "preview-constraints" job
that uploads constraints as artifacts in CI workflow, and instead
of regenerating the constraints, we can download the constraints
from uploaded artifact and use it - this is very quick and we can
also make a clear dependency between "preview" and "update"
constraints jobs - making it clear in case of PIP backtracking
that we have problem with constraints, not with the image. This
will make it far clearer when we will have problems with constraints
and backtracking that this is the real issue we have (allowing
such PRs to get merged while constraints backtracking problem is
being worked on.

(cherry picked from commit f115ec1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants