Previous: Invoking guix weather
, Up: 工具 [Contents][Index]
guix processes
The 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 involved26. Here’s an example of the information it
returns:
$ 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 environment
, 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.
The LockHeld
fields show which store items are currently locked by
this session, which corresponds to store items being built or substituted
(the LockHeld
field is not displayed when guix processes
is
not running as root). Last, by looking at the ChildPID
and
ChildCommand
fields, we understand that these three builds are being
offloaded (see 使用任务下发设施).
The output is in Recutils format so we can use the handy recsel
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
package:
$ sudo guix processes | \ recsel -p ClientPID,ClientCommand -e 'LockHeld ~ "perl"' ClientPID: 19419 ClientCommand: cuirass --cache-directory /var/cache/cuirass …
Additional options are listed below.
--format=format
-f format
Produce output in the specified format, one of:
recutils
The default option. It outputs a set of Session recutils records that
include each ChildProcess
as a field.
normalized
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
the ChildProcess
where the Session
was started using
guix build
.
$ 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.
Previous: Invoking guix weather
, Up: 工具 [Contents][Index]