Skip to content

installer: new console UI#51434

Merged
tgamblin merged 26 commits intodevelopfrom
hs/feature/installer-event-loop
Nov 6, 2025
Merged

installer: new console UI#51434
tgamblin merged 26 commits intodevelopfrom
hs/feature/installer-event-loop

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Oct 13, 2025

Warning

The new installer is experimental and not feature-complete. See #51515.

New, experimental console UI for the Spack installer that allows:

  1. Spack to show progress on multiple parallel processes concurrently;
  2. Users to view logs for different installations independently; and
  3. Spack to share a jobserver among multiple parallel builds.

Demo: https://asciinema.org/a/7azU9idEnT8ydgxcRKxYBZzI2

Usage:

  • Set config:installer to new (or use spack -c config:installer:new install ...)
  • The -j flag in spack install -j <N> ... is all you need, it will build packages in parallel. The -p flag has no effect.
  • Use n for next logs and p/N for previous logs
  • Use v to toggle between logs and overview
  • Use q or Esc to go from logs back to overview.
  • Use / to enter search mode: filters the overview as you type; press Enter to follow logs or Esc to exit search mode.

Current features:

  • create or use existing POSIX job server
  • POSIX job server client
    • first build process token is implicit
    • second, third, ... build processes require token
    • do single read from jobserver pipe to try to obtain as many tokens as there are pending builds
    • schedule as many concurrent jobs as token/bytes obtained
    • test in practice with pstree <python pid>, it seems to work
    • hook onto existing jobserver when Spack runs under it
    • keep the --jobserver-auth=R,W pipes open in the subprocess in build processes in case Spack itself runs under an existing jobserver
    • set MAKEFLAGS in a subprocess based on the gmake version of the particular build: if gmake is new enough, pass the FIFO auth flag, if gmake is old, pass the file descriptors for the FIFO instead of the FIFO path.
  • epoll/kqueue based event loop that wakes on:
    • stdin v (toggle log/overview), q (return to overview), n (next), p (previous), etc
    • jobserver token(s) available
    • SIGCHLD to deal with build success/failure
    • install phase changes from build processes
    • logs from build processes
    • fetch progress (currently not implemented in the build process, requires a callback in the fetcher)
  • IO thread in build process with another epoll/kqueue based event loop
    • wake on stdout (build process has 2>&1 redirected)
    • wake on "1"/"0" bytes from "control" pipe from parent to toggle writing to parent pipe
    • forward stdout/stderr from build process to build log file and optionally to parent process
  • responsive UI
    • overview mode that redraws every ~100ms with spinners for progress
    • log mode that follows stdout/stderr of one of the builds
    • explicit installs are always printed in bold
    • successful installs are persisted to terminal history
    • install prefix appears after successful install
    • narrower terminals show fewer details per build
    • builds are truncated with <n> more... on small terminals
  • rate limit redraw calls
  • "non-blocking" database writes
    • one attempt to obtain db write lock per iteration of the event loop (worst case ~100ms)
    • queue all specs to be persisted in the db in case of failure to obtain write lock
  • source builds
  • non-blocking install from build cache in subprocess
  • pre/post install hooks
  • build error handling

alalazo

This comment was marked as outdated.

@haampie

This comment was marked as outdated.

@haampie haampie changed the title new installer wip installer: new tui Oct 15, 2025
@rbberger
Copy link
Copy Markdown
Member

@haampie how about h for toggling a help screen for all the keys?

@tgamblin tgamblin added this to the v1.2.0 milestone Oct 27, 2025
@haampie haampie force-pushed the hs/feature/installer-event-loop branch 5 times, most recently from 083c883 to e712564 Compare November 4, 2025 08:12
@haampie haampie modified the milestones: v1.2.0, v1.1.0 Nov 4, 2025
@haampie haampie force-pushed the hs/feature/installer-event-loop branch from 91b1770 to 9ce4c56 Compare November 4, 2025 11:24
@haampie
Copy link
Copy Markdown
Member Author

haampie commented Nov 4, 2025

Rewiring jobs, locking for concurrent spack processes, and overwrite installs will have to wait for Spack v1.2, I won't get that done before v1.1.

@tgamblin tgamblin changed the title installer: new tui installer: new console UI Nov 4, 2025
@haampie haampie mentioned this pull request Nov 4, 2025
Copy link
Copy Markdown
Member

@becker33 becker33 left a comment

Choose a reason for hiding this comment

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

Hopefully this isn't too far out of date from whatever changes you made while I was reviewing it this morning/early afternoon

@haampie haampie force-pushed the hs/feature/installer-event-loop branch from 3f022f5 to fc8d6e7 Compare November 5, 2025 12:21
@haampie
Copy link
Copy Markdown
Member Author

haampie commented Nov 6, 2025

The last commit adds a search mode for the overview display so you can more easily follow logs of a specific build.

https://asciinema.org/a/4vEXbKTqOkEl7eh2wxaQpqYbO

  • Enter search with /
  • Follow logs with Enter
  • Exit search with Esc

@haampie haampie force-pushed the hs/feature/installer-event-loop branch from a2b2a39 to 9ffe671 Compare November 6, 2025 10:28
Copy link
Copy Markdown
Member

@becker33 becker33 left a comment

Choose a reason for hiding this comment

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

Everything prior to the new search mode LGTM now, couple comments on the new code.

becker33
becker33 previously approved these changes Nov 6, 2025
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
@haampie haampie force-pushed the hs/feature/installer-event-loop branch from 0f1b942 to 7ec402a Compare November 6, 2025 22:10
@tgamblin tgamblin enabled auto-merge (squash) November 6, 2025 22:51
@tgamblin tgamblin merged commit 482d589 into develop Nov 6, 2025
31 of 32 checks passed
@tgamblin tgamblin deleted the hs/feature/installer-event-loop branch November 6, 2025 23:13
@haampie haampie mentioned this pull request Nov 21, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants