2023-08-31 16:30:53 -07:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2024-02-18 16:03:01 -07:00
|
|
|
lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2"
|
2024-03-15 21:04:45 -07:00
|
|
|
# mimalloc seems to increase memory usage dramatically with openvino, need to investigate
|
|
|
|
if ! [ "$DEVICE" = "openvino" ]; then
|
|
|
|
export LD_PRELOAD="$lib_path"
|
|
|
|
export LD_BIND_NOW=1
|
|
|
|
fi
|
2023-08-31 16:30:53 -07:00
|
|
|
|
2024-03-13 10:13:56 -07:00
|
|
|
: "${MACHINE_LEARNING_HOST:=[::]}"
|
2023-08-31 16:30:53 -07:00
|
|
|
: "${MACHINE_LEARNING_PORT:=3003}"
|
|
|
|
: "${MACHINE_LEARNING_WORKERS:=1}"
|
2023-09-06 18:27:29 -07:00
|
|
|
: "${MACHINE_LEARNING_WORKER_TIMEOUT:=120}"
|
2023-08-31 16:30:53 -07:00
|
|
|
|
|
|
|
gunicorn app.main:app \
|
2023-12-14 12:51:24 -07:00
|
|
|
-k app.config.CustomUvicornWorker \
|
2024-02-18 16:03:01 -07:00
|
|
|
-w "$MACHINE_LEARNING_WORKERS" \
|
|
|
|
-b "$MACHINE_LEARNING_HOST":"$MACHINE_LEARNING_PORT" \
|
|
|
|
-t "$MACHINE_LEARNING_WORKER_TIMEOUT" \
|
2023-12-14 12:51:24 -07:00
|
|
|
--log-config-json log_conf.json \
|
|
|
|
--graceful-timeout 0
|