2024-07-27 06:49:29 +00:00
|
|
|
{ python3, writeText}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
py = python3.pkgs;
|
|
|
|
in
|
2020-11-09 15:59:12 +00:00
|
|
|
py.toPythonApplication
|
2020-04-24 23:36:52 +00:00
|
|
|
(py.mlflow.overridePythonAttrs(old: rec {
|
|
|
|
|
|
|
|
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
|
|
|
py.boto3
|
|
|
|
py.mysqlclient
|
|
|
|
];
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
postPatch = (old.postPatch or "") + ''
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
|
'';
|
2020-11-09 15:59:12 +00:00
|
|
|
}))
|