nixpkgs/pkgs/servers/mlflow-server/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
901 B
Nix
Raw Normal View History

2024-10-08 08:05:47 +00:00
{ python3Packages, writers }:
2020-01-06 23:59:25 +00:00
let
2024-10-07 15:10:18 +00:00
py = python3Packages;
2024-10-08 08:05:47 +00:00
gunicornScript = writers.writePython3 "gunicornMlflow" { } ''
2024-10-07 15:10:18 +00:00
import re
import sys
from gunicorn.app.wsgiapp import run
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', ''', sys.argv[0])
sys.exit(run())
'';
2020-01-06 23:59:25 +00:00
in
2024-10-08 08:05:47 +00:00
py.toPythonApplication (
py.mlflow.overridePythonAttrs (old: {
2020-01-06 23:59:25 +00:00
2024-10-07 15:10:18 +00:00
propagatedBuildInputs = old.dependencies ++ [
2020-01-06 23:59:25 +00:00
py.boto3
py.mysqlclient
];
2024-10-08 08:05:47 +00:00
postPatch =
(old.postPatch or "")
+ ''
cat mlflow/utils/process.py
2020-01-06 23:59:25 +00:00
2024-10-08 08:05:47 +00:00
substituteInPlace mlflow/utils/process.py --replace-fail \
"process = subprocess.Popen(" \
"cmd[0]='${gunicornScript}'; process = subprocess.Popen("
'';
2020-01-06 23:59:25 +00:00
postInstall = ''
gpath=$out/bin/gunicornMlflow
cp ${gunicornScript} $gpath
chmod 555 $gpath
'';
2024-10-08 08:05:47 +00:00
})
)