Skip to content

Improve handling of CI image timeout when backtracking#33364

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:add-backtracking-tool
Aug 14, 2023
Merged

Improve handling of CI image timeout when backtracking#33364
potiuk merged 1 commit into
apache:mainfrom
potiuk:add-backtracking-tool

Conversation

@potiuk

@potiuk potiuk commented Aug 13, 2023

Copy link
Copy Markdown
Member

Even the latest pip can enter into a long loop of backtracking when trying to find latest "good" set of dependencies with eager upgrade. This happened on August 10th 2023 with aiobotocore causing backtracking.

This PR adds a complete set of tools and instructions that can help in such cases and figure out which newly released dependency causes backtracking.

The toolset consists of:

  • adding timeout on the image build, so that it can fail before the job timeout and provide useful instructions what to do

  • adding ci find-backtracking-candidates that allows to identify the packages released after the last successful constraint update that could be the reason for backtracking

  • running the find-backtracking-candidates command in the CI when timeout occurs - this will help to see the candidates as early as possible - at the first build that will fail with timeout. This should help with narrowing down the root cause much faster

  • adding detailed explanation why we have the problem and how to deal with it step-by-step, including example based on the August 2023 backtracking issue with aiobotocore

  • finally removing --empty-image switch and pushing empty images in CI. This was an attempt to speed up waiting for image in case the image failed, but what it did, it has hidden the failures of the images when they failed. It does not really add value any more, since "image waiting" is now always done using small public runners, waiting till timeout for those is not a big issue.


^ 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

potiuk commented Aug 13, 2023

Copy link
Copy Markdown
Member Author

After this change, if CI image build fails with timeout / backtracking as root cause this is going to be the output:

Screenshot 2023-08-13 at 12 49 33

@potiuk
potiuk force-pushed the add-backtracking-tool branch from 3d61e46 to 104b740 Compare August 13, 2023 11:03
@potiuk

potiuk commented Aug 13, 2023

Copy link
Copy Markdown
Member Author

Corrected a small mistake in the instructions above:

Instead of "When it stops succeeding" : "When it still succeeds but you have one candidate only, you found the culprit."

Comment thread Dockerfile Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This part is removed from PROD image because EAGER_UPGRADE_ADDITIONAL_REQUIREMENTS is. only used in CI image.

Comment thread Dockerfile.ci Outdated
@potiuk
potiuk force-pushed the add-backtracking-tool branch 5 times, most recently from a58e4c7 to b7a4c94 Compare August 14, 2023 06:31
Even the latest pip can enter into a long loop of backtracking
when trying to find latest "good" set of dependencies with
eager upgrade. This happened on August 10th 2023 with aiobotocore
causing backtracking.

This PR adds a complete set of tools and instructions that can
help in such cases and figure out which newly released dependency
causes backtracking.

The toolset consists of:

* adding timeout on the image build, so that it can fail before
  the job timeout and provide useful instructions what to do

* adding `ci find-backtracking-candidates` that allows to identify
  the packages released after the last successful constraint update
  that could be the reason for backtracking

* running the `find-backtracking-candidates` command in the CI
  when timeout occurs - this will help to see the candidates as
  early as possible - at the first build that will fail with
  timeout. This should help with narrowing down the root cause
  much faster

* adding detailed explanation why we have the problem and how to
  deal with it step-by-step, including example based on the
  August 2023 backtracking issue with aiobotocore

* finally removing `--empty-image` switch and pushing empty images
  in CI. This was an attempt to speed up waiting for image in case
  the image failed, but what it did, it has hidden the failures
  of the images when they failed. It does not really add value
  any more, since "image waiting" is now always done using small
  public runners, waiting till timeout for those is not a big issue.
@potiuk
potiuk force-pushed the add-backtracking-tool branch from b7a4c94 to 00218db Compare August 14, 2023 06:36
@potiuk

potiuk commented Aug 14, 2023

Copy link
Copy Markdown
Member Author

Applied comment + rebased.

@potiuk
potiuk merged commit 1cf960d into apache:main Aug 14, 2023
@potiuk
potiuk deleted the add-backtracking-tool branch August 14, 2023 08:41
potiuk added a commit to potiuk/airflow that referenced this pull request Aug 14, 2023
The change apache#33364 removed accidentally --builder command that has been
used in CI to build image cache.

This PR restores it and also moves it to the "cache" option group where
it belongs.
potiuk added a commit that referenced this pull request Aug 14, 2023
The change #33364 removed accidentally --builder command that has been
used in CI to build image cache.

This PR restores it and also moves it to the "cache" option group where
it belongs.
potiuk added a commit that referenced this pull request Aug 14, 2023
The canary builds continued failing after fixing aibotocore
in #33364 when aiobotocore dependency limit dependency limit. This was
because the main build is now using "empty" eager upgrade requirements
which override the embedded aiobotocore and continue trigger
backtracking.

This is not easily visible on CI because the backtracking
error is under a folded CI image build group in CI.

This PR fixes both:

* only overrides eager requirements if they are not empty
* make sure that eager upgrade output is in the unfolded output
  of CI job
potiuk added a commit that referenced this pull request Aug 14, 2023
The canary builds continued failing after fixing aibotocore
in #33364 when aiobotocore dependency limit dependency limit. This was
because the main build is now using "empty" eager upgrade requirements
which override the embedded aiobotocore and continue trigger
backtracking.

This is not easily visible on CI because the backtracking
error is under a folded CI image build group in CI.

This PR fixes both:

* only overrides eager requirements if they are not empty
* make sure that eager upgrade output is in the unfolded output
  of CI job
@potiuk potiuk added this to the Airflow 2.7.0 milestone Aug 14, 2023
@ephraimbuddy ephraimbuddy added the changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) label Aug 15, 2023
ephraimbuddy pushed a commit that referenced this pull request Aug 15, 2023
Even the latest pip can enter into a long loop of backtracking
when trying to find latest "good" set of dependencies with
eager upgrade. This happened on August 10th 2023 with aiobotocore
causing backtracking.

This PR adds a complete set of tools and instructions that can
help in such cases and figure out which newly released dependency
causes backtracking.

The toolset consists of:

* adding timeout on the image build, so that it can fail before
  the job timeout and provide useful instructions what to do

* adding `ci find-backtracking-candidates` that allows to identify
  the packages released after the last successful constraint update
  that could be the reason for backtracking

* running the `find-backtracking-candidates` command in the CI
  when timeout occurs - this will help to see the candidates as
  early as possible - at the first build that will fail with
  timeout. This should help with narrowing down the root cause
  much faster

* adding detailed explanation why we have the problem and how to
  deal with it step-by-step, including example based on the
  August 2023 backtracking issue with aiobotocore

* finally removing `--empty-image` switch and pushing empty images
  in CI. This was an attempt to speed up waiting for image in case
  the image failed, but what it did, it has hidden the failures
  of the images when they failed. It does not really add value
  any more, since "image waiting" is now always done using small
  public runners, waiting till timeout for those is not a big issue.

(cherry picked from commit 1cf960d)
ephraimbuddy pushed a commit that referenced this pull request Aug 15, 2023
The change #33364 removed accidentally --builder command that has been
used in CI to build image cache.

This PR restores it and also moves it to the "cache" option group where
it belongs.

(cherry picked from commit 2ab0d2d)
ephraimbuddy pushed a commit that referenced this pull request Aug 15, 2023
The canary builds continued failing after fixing aibotocore
in #33364 when aiobotocore dependency limit dependency limit. This was
because the main build is now using "empty" eager upgrade requirements
which override the embedded aiobotocore and continue trigger
backtracking.

This is not easily visible on CI because the backtracking
error is under a folded CI image build group in CI.

This PR fixes both:

* only overrides eager requirements if they are not empty
* make sure that eager upgrade output is in the unfolded output
  of CI job

(cherry picked from commit 3857d33)
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 17, 2023
Even the latest pip can enter into a long loop of backtracking
when trying to find latest "good" set of dependencies with
eager upgrade. This happened on August 10th 2023 with aiobotocore
causing backtracking.

This PR adds a complete set of tools and instructions that can
help in such cases and figure out which newly released dependency
causes backtracking.

The toolset consists of:

* adding timeout on the image build, so that it can fail before
  the job timeout and provide useful instructions what to do

* adding `ci find-backtracking-candidates` that allows to identify
  the packages released after the last successful constraint update
  that could be the reason for backtracking

* running the `find-backtracking-candidates` command in the CI
  when timeout occurs - this will help to see the candidates as
  early as possible - at the first build that will fail with
  timeout. This should help with narrowing down the root cause
  much faster

* adding detailed explanation why we have the problem and how to
  deal with it step-by-step, including example based on the
  August 2023 backtracking issue with aiobotocore

* finally removing `--empty-image` switch and pushing empty images
  in CI. This was an attempt to speed up waiting for image in case
  the image failed, but what it did, it has hidden the failures
  of the images when they failed. It does not really add value
  any more, since "image waiting" is now always done using small
  public runners, waiting till timeout for those is not a big issue.
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 17, 2023
The change apache#33364 removed accidentally --builder command that has been
used in CI to build image cache.

This PR restores it and also moves it to the "cache" option group where
it belongs.
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 17, 2023
The canary builds continued failing after fixing aibotocore
in apache#33364 when aiobotocore dependency limit dependency limit. This was
because the main build is now using "empty" eager upgrade requirements
which override the embedded aiobotocore and continue trigger
backtracking.

This is not easily visible on CI because the backtracking
error is under a folded CI image build group in CI.

This PR fixes both:

* only overrides eager requirements if they are not empty
* make sure that eager upgrade output is in the unfolded output
  of CI job
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:production-image Production image improvements and fixes 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.

5 participants