Sleep and wake machines
Auto-sleep
takt machine set build-box --auto-sleep on
takt sleep build-box
takt wake build-box
With auto-sleep on, a machine sleeps after 30 minutes without jobs, when nothing queued could run on it. When queued work has no room on an awake machine without overcommitting it, the coordinator sends a Wake-on-LAN packet and holds the job for that machine for up to 3 minutes.
Packets don’t cross routers, so another awake machine on the same network sends them. A machine that doesn’t come back after 3 tries is marked won’t wake, and jobs only it can run wait until it connects again. Wake-on-LAN on laptops that use Modern Standby isn’t verified yet.
What setup changes
Installing Takt for the whole machine makes auto-sleep possible on a worker, and leaves it off until you turn it on. The plan the installer shows before asking for a password says so.
- Linux: a polkit rule (
/etc/polkit-1/rules.d/50-takt-suspend.rules) that lets Takt’s worker suspend the machine without a password, and Wake-on-LAN for magic packets on the wired card that reaches the LAN. NetworkManager’s connection keeps it on, changed without reconnecting. Without NetworkManager, the worker’s service sets it again at every start. - macOS: “Wake for network access” (
pmset womp 1), on a Mac with built-in Ethernet only. A laptop gets it on the charger only, so it doesn’t drain the battery. - Windows: nothing.
It changes nothing on the coordinator’s machine, which never sleeps. takt system repair, which runs at every start of the worker and every update, puts these back where they went missing. takt uninstall removes the rule and puts each setting back to what setup found, and says what it did.
A per-user install has no administrator, so it changes nothing: the dashboard shows the commands to run instead.
On the dashboard
Where auto-sleep works, a machine has an Auto-sleep toggle. Where something only you can fix stops it, such as the cable in a USB adapter instead of the built-in port, or Wake-on-LAN off in the firmware, the Auto-sleep button is dashed, and opens what to do. Where nothing can make a machine sleep and wake, such as a Mac without built-in Ethernet, a virtual machine or the coordinator’s machine, it has no Auto-sleep at all, and its ⋯ menu says why. Such a machine runs jobs either way. Takt never sleeps a machine running jobs.
A Windows PC between jobs
A Windows worker keeps the PC awake while it runs any job. Between jobs, Windows’ own power plan decides, and out of the box it sleeps a PC after 15 minutes idle, even plugged in, which takes it out of the fleet until someone wakes it. The machine’s card then has a note that says so. To keep the PC in the fleet, set sleep when plugged in to Never in Settings, System, Power, or run:
powercfg /change standby-timeout-ac 0
Closing a laptop’s lid
Closing the lid always wins over Takt’s jobs. A Windows worker keeps the machine awake while it runs jobs, and lets go the moment the lid closes, so Windows does what its lid action says.
The jobs running there go back to the queue at once under the same ID, uncounted as failures or retries, and run elsewhere. The machine shows asleep since 14:05 (lid closed), takes no jobs, and Takt doesn’t wake it until the lid opens again. A lid action of “Do nothing” (a laptop docked with its lid shut) keeps its jobs running. Linux and macOS workers never hold a closed lid open, so those laptops sleep as they always do.
A Linux worker tells the coordinator just before its machine sleeps, for any reason (systemd 257 or later), so its jobs move to another machine at once and it shows asleep until it wakes. A machine that sleeps without a word, such as a Mac, drops off the network: its jobs move once it has been gone for 2 minutes.
Interactive mode
takt machine set laptop --interactive on
For a machine someone is using. Takt keeps 2 cores (1 on a machine with 4 or fewer) and 4 GB of memory free for the person, stops overcommitting its CPU sooner, and runs its jobs at the lowest CPU and IO priority. It takes effect at once, for running jobs too. It’s on by default on laptops.
On Linux, container jobs yield too after a one-time setup that takt status prints:
sudo takt machine setup-interactive --user $USER
Take a machine out of use
takt machine set laptop --jobs off
takt machine set laptop --jobs on
Or turn Run jobs here off in its ⋯ menu on the dashboard. Its running jobs go back to the queue under the same id, uncounted as failures, and run elsewhere. takt status and the dashboard say jobs off: Takt runs nothing there and doesn’t sleep or wake it until someone turns Run jobs here on again.