diff options
author | Atemu <atemu.main@gmail.com> | 2024-03-26 19:45:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-26 19:45:45 +0000 |
commit | f54166d281337b28d76cdaad73b8d6dee1574fd0 (patch) | |
tree | 369eb0947b3bf893ff7e6b8dc4f0e8ffedb7135d /nixos/modules/services | |
parent | 1f704fabb288da87c0bbceb27277ba94b333e6c8 (diff) | |
parent | 70fa188e175ab9d1034416374b2af15ad94decbc (diff) | |
download | nixlib-f54166d281337b28d76cdaad73b8d6dee1574fd0.tar nixlib-f54166d281337b28d76cdaad73b8d6dee1574fd0.tar.gz nixlib-f54166d281337b28d76cdaad73b8d6dee1574fd0.tar.bz2 nixlib-f54166d281337b28d76cdaad73b8d6dee1574fd0.tar.lz nixlib-f54166d281337b28d76cdaad73b8d6dee1574fd0.tar.xz nixlib-f54166d281337b28d76cdaad73b8d6dee1574fd0.tar.zst nixlib-f54166d281337b28d76cdaad73b8d6dee1574fd0.zip |
Merge pull request #299008 from Atemu/paperless-OMP_NUM_THREADS
nixos/paperless: set OMP_NUM_THREADS=1 by default
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/misc/paperless.nix | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/paperless.nix b/nixos/modules/services/misc/paperless.nix index 9314c4f3848d..9301d1f68725 100644 --- a/nixos/modules/services/misc/paperless.nix +++ b/nixos/modules/services/misc/paperless.nix @@ -27,6 +27,8 @@ let name = "paperless_ngx_nltk_data"; paths = pkg.nltkData; }; + } // optionalAttrs (cfg.openMPThreadingWorkaround) { + OMP_NUM_THREADS = "1"; } // (lib.mapAttrs (_: s: if (lib.isAttrs s || lib.isList s) then builtins.toJSON s else if lib.isBool s then lib.boolToString s @@ -199,6 +201,20 @@ in }; package = mkPackageOption pkgs "paperless-ngx" { }; + + openMPThreadingWorkaround = mkEnableOption '' + a workaround for document classifier timeouts. + + Paperless uses OpenBLAS via scikit-learn for document classification. + + The default is to use threading for OpenMP but this would cause the + document classifier to spin on one core seemingly indefinitely if there + are large amounts of classes per classification; causing it to + effectively never complete due to running into timeouts. + + This sets `OMP_NUM_THREADS` to `1` in order to mitigate the issue. See + https://github.com/NixOS/nixpkgs/issues/240591 for more information. + '' // mkOption { default = true; }; }; config = mkIf cfg.enable { |