Tasks#
A task is a Bash executable under tasks: the commands a
developer would type to reach one goal. It runs by hand, and
--help prints the one form its arguments take:
$ tasks/kernel/build --help
Usage: tasks/kernel/build --directory DIR
Build the Linux tree in DIR, in its build/, as the .config there says:
tasks/kernel/build --directory ~/linux
A task’s log is a transcript: each command after a $
prompt, exactly as it ran, then what it printed. A line copied from it does the
same in a terminal, so a failed run reproduces from its log. An
option keeps the name its tool gives the
argument, as --directory is make’s own.
Note
The line a task logs for its tool names the unit, not the unit’s settings. Where it runs, what it may write and what files its record are the drop-ins under its name (The unit a task runs in), so the line does the same only on a host that has them linked.
The unit a task runs in#
What a task prints#
A task runs its tool as a unit of your service manager, named for the task
and the directory it works in: kernel-build@home-user-linux.service builds
/home/user/linux. The task shows what the tool prints as it comes, and exits
with the tool’s status. Your journal keeps it (The journal),
with the tool’s standard error as warnings and every line under the
unit’s name as its identifier.
To follow a run from another terminal, by the name the task printed:
$ journalctl --user --identifier kernel-build@home-user-linux.service \
--follow
Only its warnings and errors:
$ journalctl --user --identifier kernel-build@home-user-linux.service \
--priority warning
What the unit runs, and the processor time and memory it has taken:
$ systemctl --user status 'kernel-build@*'
Note
The same task is refused a second run on a directory while the first lasts.
Note
journalctl --user-unit misses lines. journald names a line’s unit
only while the process that wrote it lives, so the last errors of a
compiler that has exited carry no unit. The identifier is on every
line.
The unit’s settings#
A unit’s settings are drop-ins under its name, which
kdevops-ng ships in units/user (The units’ settings). They
have the unit run in the directory it works in, see that directory and
your home read-only, and write only where the task’s tool keeps what it
makes, as build/ of a Linux tree, and ~/.local/state, where
records go.
A drop-in of your own changes or adds a setting. One under the task’s name holds for every tree, and one under a unit’s full name for that tree:
$ mkdir --parents --verbose ~/.config/systemd/user/kernel-build@.service.d
[Service]
MemoryHigh=16G
RuntimeMaxSec=2h
$ systemctl --user daemon-reload
While a task runs, systemctl --user status lists the drop-ins
its unit took. The settings most useful for a build:
Setting |
Example |
What it does |
|---|---|---|
|
Slows the build down above 16G of memory, without killing it. |
|
|
Has the kernel kill a process of the build above 24G. |
|
|
Ends the whole build when the kernel kills one of its processes for memory, where the default lets make go on. |
|
|
Holds the build to the time of 8 processors. |
|
|
Gives the build a fifth of the default share when processors are contended, so the desktop stays responsive. |
|
|
Lowers the build’s scheduling priority. |
|
|
Caps the number of processes and threads. |
|
|
Fails the build after two hours. |
|
|
Lets the build write one more directory, here a compiler cache in your home. |
|
|
Sets a variable for make. The unit gets none of your shell’s. |
|
|
Puts the build in a slice of your own, whose limits then hold for every unit in it together. |