summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorJohn Soo <jsoo1@asu.edu>2020-11-04 07:51:52 -0800
committerLudovic Courtès <ludo@gnu.org>2020-11-29 23:55:57 +0100
commit58be9e0bf1e58131e4e8d2b74f41b7b8e154b4b8 (patch)
tree3429aa3a0ca874662b64567e18a6a7c831963098 /doc
parente1c81203ca9aa8a6dedb7c539d3ff845626aadcc (diff)
downloadguix-58be9e0bf1e58131e4e8d2b74f41b7b8e154b4b8.tar.gz
processes: Add '--format' and the "normalized" format.
* guix/scripts/processes.scm (lock->recutils): New procedure.
(daemon-session->recutils): Use it.
(daemon-sessions->recutils, session-key->recutils)
(session-scalars->normalized-record)
(child-process->normalized-record)
(daemon-sessions->normalized-record): New procedures.
(session-rec-type, lock-rec-type, child-process-rec-type)
(%available-formats): New variables.
(list-formats): New procedure.
(%options, show-help): Add '--format'.
(%default-options): New variable.
(guix-processes): Use 'parse-command-line' instead of 'args-fold*'.
Honor the 'format' value in OPTIONS.
* doc/guix.texi (Invoking guix processes): Document '--format'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi39
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 7cef2371ad..e7277fc9ee 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12899,6 +12899,45 @@ ClientPID: 19419
 ClientCommand: cuirass --cache-directory /var/cache/cuirass @dots{}
 @end example
 
+Additional options are listed below.
+
+@table @code
+@item --format=@var{format}
+@itemx -f @var{format}
+Produce output in the specified @var{format}, one of:
+
+@table @code
+@item recutils
+The default option. It outputs a set of Session recutils records
+that include each @code{ChildProcess} as a field.
+
+@item normalized
+Normalize the output records into record sets (@pxref{Record Sets,,,
+recutils, GNU recutils manual}).  Normalizing into record sets allows
+joins across record types.  The example below lists the PID of each
+@code{ChildProcess} and the associated PID for @code{Session} that
+spawned the @code{ChildProcess} where the @code{Session} was started
+using @command{guix build}.
+
+@example
+$ 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
+@end example
+@end table
+@end table
+
 @node System Configuration
 @chapter System Configuration