Open azdolinski opened 3 weeks ago
is it possible to add env for uvicorn options? It could be useful to increase the number of workers like this fastapi with workers
@sir3mat - yes... it should be possible... env like PIPELINES_WORKERS
based on docs - https://github.com/defunkt/unicorn/blob/master/README "unicorn can spawn and manage any number of worker processes you choose to scale to your backend." https://www.engineyard.com/blog/everything-you-need-to-know-about-unicorn/
it could be somthing like this...
if [ "$PIPELINES_ENV" = "production" ] || [ -z "$PIPELINES_ENV" ]; then
if [ "$PIPELINES_WORKERS" = "auto" ]; then
CPU_COUNT=$(nproc)
WORKERS=$((2 * CPU_COUNT + 1))
else
WORKERS="${PIPELINES_WORKERS:-1}"
fi
uvicorn main:app --host "$HOST" --port "$PORT" --workers "$WORKERS" --forwarded-allow-ips '*'
else
echo "INFO: Running in development mode"
# "workers" flag will be ignored when reloading is enabled.
uvicorn main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips '*' --reload
fi
i will try to check that later... but now i need also support venv for requirments and that is on my top task list
start.sh
PIPELINES_ENV
(string)
"production"
, uvicorn
will be configured to run with 1
worker and the --reload
flag. Information about this flag can be found in the uvicorn
development documentation.production
PIPELINES_WORKERS
(number|auto)
uvicorn
starts by default only with 1
worker.auto
, which calculates the ideal number of workers based on available CPU cores.PIPELINES_VENV
(boolean)
False
True
will ensure that the pipelines run within a specified virtual environment.PIPELINES_VENV_AUTOUPGRADE
(boolean)
requirements.txt
when using a virtual environment. This parameter makes sense only if you are using a permanent volume
for the venv folder.False
True
to enable the automatic pip and package upgrade process during start.PIPELINES_VENV_PATH
(os path string)
${PIPELINES_DIR}/venv
, aligning with the directory structure of the pipelines.Is it possible to enable also the "workers" params in openwebui interface?
@sir3mat Pipelines is a separate, dedicated container and project. The number of pipeline workers is a parameter set at the start of the pipelines container and needs to be predefined at startup. Settings such as env parameters SHOULD NOT be influenced or driven by other projects from the outside; instead, they should be defined by the administrator during the startup process, as these env parameters impact how the entire system behaves.
Enhance the
start.sh
script to recognize and utilize thePIPELINES_ENV
environment variable as follows:Development Mode:
PIPELINES_ENV=development
, executeuvicorn
with the--reload
option. This will streamline the development process of Python pipelines by automatically reloading the server upon code changes.Production Mode:
PIPELINES_ENV=production
or ifPIPELINES_ENV
is unset or undefined, runuvicorn
in its standard mode without the--reload
option.This change will accommodate both development and production environments seamlessly.