blob: a043d22aa9784173b0a69d52420fb9a07731d5af (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
{lib, python3, writeText}:
let
py = python3.pkgs;
in
py.toPythonApplication
(py.mlflow.overridePythonAttrs(old: rec {
propagatedBuildInputs = old.propagatedBuildInputs ++ [
py.boto3
py.mysqlclient
];
postPatch = (old.postPatch or "") + ''
substituteInPlace mlflow/utils/process.py --replace \
"child = subprocess.Popen(cmd, env=cmd_env, cwd=cwd, universal_newlines=True," \
"cmd[0]='$out/bin/gunicornMlflow'; child = subprocess.Popen(cmd, env=cmd_env, cwd=cwd, universal_newlines=True,"
'';
gunicornScript = writeText "gunicornMlflow"
''
#!/usr/bin/env python
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())
'';
postInstall = ''
gpath=$out/bin/gunicornMlflow
cp ${gunicornScript} $gpath
chmod 555 $gpath
'';
}))
|