guix processes command can be useful to developers and system
administrators, especially on multi-user machines and on build farms: it
lists the current sessions (connections to the daemon), as well as
information about the processes involved24. Here’s an example of the information it
$ sudo guix processes SessionPID: 19002 ClientPID: 19090 ClientCommand: guix shell python SessionPID: 19402 ClientPID: 19367 ClientCommand: guix publish -u guix-publish -p 3000 -C 9 … SessionPID: 19444 ClientPID: 19419 ClientCommand: cuirass --cache-directory /var/cache/cuirass … LockHeld: /gnu/store/…-perl-ipc-cmd-0.96.lock LockHeld: /gnu/store/…-python-six-bootstrap-1.11.0.lock LockHeld: /gnu/store/…-libjpeg-turbo-2.0.0.lock ChildPID: 20495 ChildCommand: guix offload x86_64-linux 7200 1 28800 ChildPID: 27733 ChildCommand: guix offload x86_64-linux 7200 1 28800 ChildPID: 27793 ChildCommand: guix offload x86_64-linux 7200 1 28800
In this example we see that
guix-daemon has three clients:
guix publish, and the Cuirass
continuous integration tool; their process identifier (PID) is given by the
ClientPID field. The
SessionPID field gives the PID of the
guix-daemon sub-process of this particular session.
LockHeld fields show which store items are currently locked by
this session, which corresponds to store items being built or substituted
LockHeld field is not displayed when
guix processes is
not running as root). Last, by looking at the
ChildCommand fields, we understand that these three builds are being
offloaded (see 下发工作给后台进程的设置).
The output is in Recutils format so we can use the handy
command to select sessions of interest (see Selection Expressions in GNU recutils manual). As an example, the command shows the
command line and PID of the client that triggered the build of a Perl
$ sudo guix processes | \ recsel -p ClientPID,ClientCommand -e 'LockHeld ~ "perl"' ClientPID: 19419 ClientCommand: cuirass --cache-directory /var/cache/cuirass …
Additional options are listed below.
Produce output in the specified format, one of:
The default option. It outputs a set of Session recutils records that
ChildProcess as a field.
Normalize the output records into record sets (see Record Sets in GNU recutils manual). Normalizing into record sets allows joins
across record types. The example below lists the PID of each
ChildProcess and the associated PID for
Session that spawned
ChildProcess where the
Session was started using
$ guix processes --format=normalized | \ recsel \ -j Session \ -t ChildProcess \ -p Session.PID,PID \ -e 'Session.ClientCommand ~ "guix build"' PID: 4435 Session_PID: 4278 PID: 4554 Session_PID: 4278 PID: 4646 Session_PID: 4278
Remote sessions, when
guix-daemon is started with --listen specifying a TCP
endpoint, are not listed.