-
Notifications
You must be signed in to change notification settings - Fork 450
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
refactor: lake: --wfail
& track jobs & logs & simplify build monads
#3835
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tydeu
changed the title
refactor: lake: keep track of logs instead of eagerly printing them
refactor: lake: track logs instead of eagerly printing them
Apr 5, 2024
github-actions
bot
added
the
toolchain-available
A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
label
Apr 5, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 5, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 5, 2024
leanprover-community-mathlib4-bot
added
the
breaks-mathlib
This is not necessarily a blocker for merging: but there needs to be a plan
label
Apr 5, 2024
Mathlib CI status (docs):
|
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 5, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 5, 2024
tydeu
changed the title
refactor: lake: track logs instead of eagerly printing them
refactor: lake: track logs & simplify build monad stack
Apr 5, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 5, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 5, 2024
tydeu
changed the title
refactor: lake: track logs & simplify build monad stack
refactor: lake: track jobs & logs & simplify the build monad stack
Apr 6, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 6, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 6, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 6, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 6, 2024
!bench |
Here are the benchmark results for commit 1c01757. Benchmark Metric Change
================================================
+ lake build no-op task-clock -9.4% (-17.5 σ)
- stdlib maxrss 16.9% (871.0 σ)
- stdlib wall-clock 2.2% (12.7 σ) |
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 8, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 8, 2024
tydeu
force-pushed
the
lake/log-refactor
branch
from
April 18, 2024 19:12
1bd5fc8
to
8135218
Compare
tydeu
force-pushed
the
lake/log-refactor
branch
4 times, most recently
from
April 20, 2024 01:38
dd1f3f1
to
dfe87cc
Compare
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 29, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 29, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 29, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 29, 2024
tydeu
force-pushed
the
lake/log-refactor
branch
from
April 29, 2024 20:13
f88e366
to
e5beae8
Compare
tydeu
force-pushed
the
lake/log-refactor
branch
from
April 29, 2024 20:51
e5beae8
to
0be14b3
Compare
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 29, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 29, 2024
tydeu
changed the title
refactor: lake: track jobs & logs & simplify the build monad stack
refactor: lake: Apr 29, 2024
--wfail
& track jobs & logs & simplify build monads
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Apr 30, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 30, 2024
…#3835) This is a major refactor of Lake's build code. The key changes: * **Job Registration**: Significant build jobs are now registered by build functions. The DSL inserts this registration automatically into user-defined targets and facets, so this change should require no end-user adaption. Registered jobs are incrementally awaited by the main build function and the progress counter now indicates how many of these jobs are completed and left-to-await. On the positive side, this means the counter is now always accurate. On the negative side, this means that jobs are displayed even if they are no-ops (i.e., if the target is already up-to-date). * **Log Retention**: Logs are now part of a Lake monad's state instead of being eagerly printed. As a result, build jobs retain their logs. Using this change, logs are are now always printed after their associated caption (e.g., `[X/Y] Building Foo`) and are not arbitrarily interleaved with the output of other jobs. * **Simplify the build monad stack**: Previously, there was a lot of confused mixing between the various build monads in the codebase (i.e., `JobM`, `ScedulerM`, `BuildM`, `RecBuildM`, and `IndexBuildM` ). This refactor attempts to make there use more consistent and straightforward: * `FetchM` (formerly `IndexBuildM`) is the top-level build monad used by targets and facets and is now uniformly used in the codebase for all top-level build functions. * `JobM` is the monad of asynchronous build jobs. It is more limited than `FetchM` due to the fact that the build cache can not be modified asynchronously. * `SpawnM` (formerly `SchedulerM`) is the monad used to spawn build jobs. It lifts into `FetchM`. * `RecBuildM` and `CoreBuildM` (formerly `BuildM`) have been relegated to internal details of how `FetchM` / `JobM` are implemented / run and are no longer used outside of that context. * **Pretty progress.** Build progress (e.g., `[X/Y] Building Foo`) is now updated on a single line via ANSI escape sequences when Lake is outputting to a terminal. Redirected Lake output still sees progress on separate lines. * **Warnings-as-error option.** Adds a `--wfail` option to Lake that will cause a build to fail if Lake logs any warnings doing a build. Unlike some systems, this does not convert warnings into errors and it does not abort jobs which log warnings. Instead, only the top-level build fails. * **Build log cache.** Logs from builds are now cached to a file and replayed when the build is revisited. For example, this means multiple runs of a `--wfail` Lean build (without changes) will still produce the same warnings even though there is now an up-to-date `.olean` for the module. Closes #2349. Closes #2764.
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 30, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 30, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
May 1, 2024
Fixes some bugs with the log refactor (#3835). Namely, quiet mode progress printing and missing string interpolation in the fetching cloud release caption.
!bench |
Here are the benchmark results for commit 49d59f9. Benchmark Metric Change
======================================
- stdlib maxrss 16.6% (1092.1 σ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaks-mathlib
This is not necessarily a blocker for merging: but there needs to be a plan
toolchain-available
A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
will-merge-soon
…unless someone speaks up
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a major refactor of Lake's build code. The key changes:
Job Registration: Significant build jobs are now registered by build functions. The DSL inserts this registration automatically into user-defined targets and facets, so this change should require no end-user adaption. Registered jobs are incrementally awaited by the main build function and the progress counter now indicates how many of these jobs are completed and left-to-await. On the positive side, this means the counter is now always accurate. On the negative side, this means that jobs are displayed even if they are no-ops (i.e., if the target is already up-to-date).
Log Retention: Logs are now part of a Lake monad's state instead of being eagerly printed. As a result, build jobs retain their logs. Using this change, logs are are now always printed after their associated caption (e.g.,
[X/Y] Building Foo
) and are not arbitrarily interleaved with the output of other jobs.Simplify the build monad stack: Previously, there was a lot of confused mixing between the various build monads in the codebase (i.e.,
JobM
,ScedulerM
,BuildM
,RecBuildM
, andIndexBuildM
). This refactor attempts to make there use more consistent and straightforward:FetchM
(formerlyIndexBuildM
) is the top-level build monad used by targets and facets and is now uniformly used in the codebase for all top-level build functions.JobM
is the monad of asynchronous build jobs. It is more limited thanFetchM
due to the fact that the build cache can not be modified asynchronously.SpawnM
(formerlySchedulerM
) is the monad used to spawn build jobs. It lifts intoFetchM
.RecBuildM
andCoreBuildM
(formerlyBuildM
) have been relegated to internal details of howFetchM
/JobM
are implemented / run and are no longer used outside of that context.Pretty progress. Build progress (e.g.,
[X/Y] Building Foo
) is now updated on a single line via ANSI escape sequences when Lake is outputting to a terminal. Redirected Lake output still sees progress on separate lines.Warnings-as-error option. Adds a
--wfail
option to Lake that will cause a build to fail if Lake logs any warnings doing a build. Unlike some systems, this does not convert warnings into errors and it does not abort jobs which log warnings. Instead, only the top-level build fails.Build log cache. Logs from builds are now cached to a file and replayed when the build is revisited. For example, this means multiple runs of a
--wfail
Lean build (without changes) will still produce the same warnings even though there is now an up-to-date.olean
for the module.Closes #2349. Closes #2764.