Pausing Guix Builds

Pause long runs of guix build

2020-12-05 09:09AM PSTJohn Soojsoo1@asu.edu

You can now pause guix builds using guix processes, xargs and recutils.

To pause all processes:

guix processes --format=normalized \
  | recsel -t ChildProcess -j Session \
  | recfmt -- ' -{{PID}} -{{Session.PID}}' \
  | xargs sudo kill -s SIGSTOP

To resume all processes, use SIGCONT instead of SIGSTOP:

guix processes --format=normalized \
  | recsel -t ChildProcess -j Session \
  | recfmt -- ' -{{PID}} -{{Session.PID}}' \
  | xargs sudo kill -s SIGCONT

To specify which session to pause/resume, use the -e recsel flag. Here, the tilde means to filter based on regex match. Replace the search terms with the command you want to pause. You can also get quite creative here, recutils are very flexible.

guix processes --format=normalized \
  | recsel -t ChildProcess -j Session -e 'Session.ClientCommand ~ "guix system reconfigure"' \
  | recfmt -- ' -{{PID}} -{{Session.PID}}' \
  | xargs sudo kill -s SIGSTOP