sai-powerOverviewsai-power is an optional helper daemon that is designed to run on the same subnet as the builders, and be up all the time. It has two tasks:
Configuration of sai-powersai-power looks for JSON config at /etc/sai/power/conf. It looks like this It describes one or more sai-server that it should keep tabs on, and for each server, a list of builders and how to manage their power. Two types of builder power management is supported
Some builders, eg, repurposed laptops, may suspend well but not actually have any simple way to be powered down and turned on again (eg, only way is power key on keyboard; battery will try to power it if you simply turn off mains power to it). Conversely, some SBCs can be powered on and off from the mains well, turning on automatically when power reapplied, but suspend or WOL does not work properly on them. So both approaches are needed. Blade 3 SBC has another corner case, if you shutdown -h now before removing the power, the SBC stays awake enough with power in its capacitors for many minutes to not come back up properly when you reapply power; it reaches a kind of zombie state where it feels it is OFF despite being powered. You can work around this kind of case by using shutdown -H instead, which does the OS shutdown but doesn't ask the kernel to "turn OFF". This drains the caps in under a second and it is able to be managed normally then. Configuration at the builderBuilders that participate in sai-power management need to point to sai-power in ther configuration, for example The builder's "host" entry is matched to the sai-power configuration to allow the builder to request sai power to turn itself off. Builder power control manuallyBuilders that are managed by sai-power are OFF a lot, basically any time it finished building the last push until the next one, which may be whole days or more. If you need to ssh in to them to manage them, that is inconvenient since they are literally OFF. Even if you caught them while on and building, they can choose to go OFF or suspend at any time. To simplify that case, you can manually ask sai-power to start up a builder. You can also manually turn off the builder from the same api. Asking sai-power to do it has some advantages:
In order to reset the idle detection, you should manually use sai-power to power down the builder. Next time it starts, idle detection will be operational again. |