lol

Merge pull request #299008 from Atemu/paperless-OMP_NUM_THREADS

nixos/paperless: set OMP_NUM_THREADS=1 by default

authored by

Atemu and committed by
GitHub
f54166d2 1f704fab

+16
+16
nixos/modules/services/misc/paperless.nix
··· 27 27 name = "paperless_ngx_nltk_data"; 28 28 paths = pkg.nltkData; 29 29 }; 30 + } // optionalAttrs (cfg.openMPThreadingWorkaround) { 31 + OMP_NUM_THREADS = "1"; 30 32 } // (lib.mapAttrs (_: s: 31 33 if (lib.isAttrs s || lib.isList s) then builtins.toJSON s 32 34 else if lib.isBool s then lib.boolToString s ··· 199 201 }; 200 202 201 203 package = mkPackageOption pkgs "paperless-ngx" { }; 204 + 205 + openMPThreadingWorkaround = mkEnableOption '' 206 + a workaround for document classifier timeouts. 207 + 208 + Paperless uses OpenBLAS via scikit-learn for document classification. 209 + 210 + The default is to use threading for OpenMP but this would cause the 211 + document classifier to spin on one core seemingly indefinitely if there 212 + are large amounts of classes per classification; causing it to 213 + effectively never complete due to running into timeouts. 214 + 215 + This sets `OMP_NUM_THREADS` to `1` in order to mitigate the issue. See 216 + https://github.com/NixOS/nixpkgs/issues/240591 for more information. 217 + '' // mkOption { default = true; }; 202 218 }; 203 219 204 220 config = mkIf cfg.enable {