hydra-module: Always GC to have at least 100 GiB available.
[?]
Jun 14, 2012, 8:57 AM
3FTM52B2FQBNZ4GANKVIFALA757VXJEP3K4QLVJYQSDWIK7IP5VACDependencies
- [2]
QQU7AL7Ihydra-module.nix: Remove `.pl' extension for binaries. - [3]
XYZ6FQ7Zhydra-module: Fix typo in the job name in `checkSpace'. - [4]
CTYUTPEDhydra-module: Remove `nix.*' settings. - [5]
WXW2GAJY_ -> - - [6]
D3MDJONY
Change contents
- replacement in hydra-module.nix at line 144
nix.gc.automatic = true;# $3 / $4 don't always work depending on length of device namenix.gc.options = ''--max-freed "$((200 * 1024**3 - 1024 * $(df /nix/store | tail -n 1 | awk '{ print $3 }')))"'';# We have our own crontab entries for GC, see below.nix.gc.automatic = false; - replacement in hydra-module.nix at line 202[4.5127]→[4.5127:5496](∅→∅),[4.5496]→[3.0:40](∅→∅),[3.40]→[4.5536:5704](∅→∅),[4.5536]→[4.5536:5704](∅→∅),[4.5704]→[3.41:78](∅→∅),[3.78]→[4.5741:6171](∅→∅),[4.5741]→[4.5741:6171](∅→∅),[4.6171]→[2.519:641](∅→∅),[2.641]→[4.6296:6304](∅→∅),[4.656]→[4.6296:6304](∅→∅),[4.6296]→[4.6296:6304](∅→∅)
let# If there is less than ... GiB of free disk space, stop the queue# to prevent builds from failing or aborting.checkSpace = pkgs.writeScript "hydra-check-space"''#! /bin/shif [ $(($(stat -f -c '%a' /nix/store) * $(stat -f -c '%S' /nix/store))) -lt $((${toString cfg.minimumDiskFree} * 1024**3)) ]; thenstop hydra_queue_runnerfiif [ $(($(stat -f -c '%a' /nix/store) * $(stat -f -c '%S' /nix/store))) -lt $((${toString cfg.minimumDiskFreeEvaluator} * 1024**3)) ]; thenstop hydra_evaluatorfi'';compressLogs = pkgs.writeScript "compress-logs" ''#! /bin/sh -etouch -d 'last month' rfind /nix/var/log/nix/drvs -type f -a ! -newer r -name '*.drv' | xargs bzip2 -v'';in[ "*/5 * * * * root ${checkSpace} &> ${cfg.baseDir}/data/checkspace.log""15 5 * * * root ${compressLogs} &> ${cfg.baseDir}/data/compress.log""15 02 * * * ${cfg.user} ${env} ${cfg.hydra}/bin/hydra-update-gc-roots &> ${cfg.baseDir}/data/gc-roots.log"];let# If there is less than ... GiB of free disk space, stop the queue# to prevent builds from failing or aborting.checkSpace = pkgs.writeScript "hydra-check-space"''#! /bin/shif [ $(($(stat -f -c '%a' /nix/store) * $(stat -f -c '%S' /nix/store))) -lt $((${toString cfg.minimumDiskFree} * 1024**3)) ]; thenstop hydra_queue_runnerfiif [ $(($(stat -f -c '%a' /nix/store) * $(stat -f -c '%S' /nix/store))) -lt $((${toString cfg.minimumDiskFreeEvaluator} * 1024**3)) ]; thenstop hydra_evaluatorfi''; - replacement in hydra-module.nix at line 216
};}collect = pkgs.writeScript "collect-some-garbage"# Arrange to always have at least 100 GiB free.'' #!/bin/sh -eavailable="$(df -B1 /nix/store | tail -n 1 | awk '{ print $4 }')"target="$((100 * 1024**3))"to_free="$(($available > $target ? 200 * 1024**2 : $target - $available))"echo "$available B available, and targeting $target B available"echo "thus, freeing $to_free B"exec "${pkgs.nix}/bin/nix-collect-garbage" --max-freed "$to_free"'';compressLogs = pkgs.writeScript "compress-logs" ''#! /bin/sh -etouch -d 'last month' rfind /nix/var/log/nix/drvs -type f -a ! -newer r -name '*.drv' | xargs bzip2 -v'';in[ "15 03 * * * root ${collect} &> ${cfg.baseDir}/data/gc.log""15 13 * * * root ${collect} &> ${cfg.baseDir}/data/gc.log" - edit in hydra-module.nix at line 237[4.6315]
"*/5 * * * * root ${checkSpace} &> ${cfg.baseDir}/data/checkspace.log""15 5 * * * root ${compressLogs} &> ${cfg.baseDir}/data/compress.log""15 02 * * * ${cfg.user} ${env} ${cfg.hydra}/bin/hydra-update-gc-roots &> ${cfg.baseDir}/data/gc-roots.log"];};}