-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimizing publish from the core-tools #132
Comments
/cc @pragnagopa , @priyaananthasankar @elprans Here's a brain dump. I'll let you take it from here. |
Adding another suggestion/question to the proposed workflow: When you pip install pure .py packages subsequently after a first installation - docker has a way to figure if it is a re-install or a fresh install, through a build context. Or maybe provide a flag if docker needs to forget and consider a re-install. Noticed that irrespective of first time or subsequent times, all the python packages are again installed. Would be great if this can be fixed. I think when publishing anything for the first time, we are prepared for a decent latency. But subsequent publish - like changing a line of code and redeploying etc should be much faster than a first publish. |
Why is the docker container even necessary if we are doing a pip install outside the container already? Could you just zip up the current folder and zipdeploy it to the function app? |
@aluong you're right, the docker step is not necessary. In the optimized workflow, step #3 would only be triggered if you're using a c extension package that does not have pre-built wheels available on PyPI. I don't have the exact data available but expect it to be an uncommon scenario. The whole idea behind using docker is to build the right binaries for our production environment. The alternate to docker would be to use a Linux based CI server to build these binaries. The later workflow is on our backlog but further down the pipeline. |
@elprans So I'm stuck because of this issue pypa/pip#4390 I was testing with I was thinking I'd install the packages in a folder However it looks like |
@ahmelsayed You don't need |
bear with me since I'm not very familiar with the python eco system :) without
as oppose to
and when you do
|
Until we publish the worker on PyPi you need to install the worker from the git checkout, just without $ git clone https://github.com/Azure/azure-functions-python-worker.git
$ cd azure-functions-python-worker
$ pip install . |
@ahmelsayed @asavaritayal I decided to build a standalone Python module to create Python app packages for Azure. It would take the
core-tools would then simply need to add the above call. |
How long does the
|
The packer will download wheels if available, and if not, it will try to build them locally (using Docker for binary wheels). Regarding the base requirements: why do we have to install them every time? Can these be baked into the base image? In fact, the docker-less deployment relies on the virtual Python environment already being present in the image. |
The https://pypi.org/project/azure-functions/ pip install azure-functions https://pypi.org/project/azure-functions-worker/ pip install azure-functions-worker /cc @elprans |
I'm having issues trying to get packapp.py script to work. First I made a small change to copy the output to a folder under the current project It works fine with the cli on my machine, but it keeps erroring out with
|
Do you have steps to reproduce? |
# Create a new empty venv
$ python3 -m venv test_venv
$ source test_venv/bin/activate
# download my modified packapp.py
$ wget https://raw.githubusercontent.com/Azure/azure-functions-python-worker/1fb57ee25bcfac3026ae3e42f6f2a13bc3e5cced/azure/worker/tools/packapp.py
# install latest dislib
$ pip install -U 'git+https://github.com/vsajip/distlib.git@15dba58a827f56195b0fa0afe80a8925a92e8bf5'
$ git clone https://github.com/ahmelsayed/python-functions
$ cd python-functions
# this should create a .python_packages in the current directory
$ python ../packapp.py --platform linux --python-version 36 .
# The Dockerfile just copies everything under /home/site/wwwroot
$ sudo docker build -t docker-python .
$ sudo docker run -it -p 8080:80 docker-python
$ curl http://localhost:8080/api/HttpTriggerPython |
But make sure to wait until this image is done building https://hub.docker.com/r/microsoft/azure-functions-python3.6/builds/ |
hmmm, it works on my home machine as well. Let me try again in Azure. I'm not sure what might be wrong with my machine at work |
running
results in this error
|
@ahmelsayed Should we move this script to a different repo to make improvements and fixes more straightforward? |
yes, I actually added it here https://github.com/Azure/azure-functions-core-tools/blob/master/tools/python/packapp.py to be included in the cli build with the same change I mentioned earlier (not zipping) and adding a |
Thanks everyone for the feedback. The new version of the core tools - Note that the quick start instructions have changed in the last couple of weeks - https://github.com/Azure/azure-functions-python-worker/wiki/Create-Function-(CLI) If you're not starting over from scratch, confirm that the
|
A consistent theme across private preview has been the extended time taken to publish an app from the core-tools.
Current Workflow
Behind the scenes the publish command will: InternalPreparePythonDeployment Method
microsoft/azure-functions-python3.6:v2.0.11651-alpha
requirements.txt
to the running containerworker_venv
under/home/site/wwwroot
pip install -r requirements.txt
in the containerProposed Workflow
Create a venv for the project named
worker_env
. Activate it.For packages in
requirements.txt
, determine if they are pure .py packages or c extensions with universal wheels available on PyPI. Install these packages toworker_env
usingpip
.If
requirements.txt
contains c extension packages that do not have universal wheels on PyPI,microsoft/azure-functions-python3.6:v2.0.11651-alpha
worker_env
andrequirements.txt
to the running container under/home/site/wwwroot
worker_env
outside the containerPackage the python functions and worker_env together as a zip file for deployment to Azure
Notes
Currently, there are no wheels available for
azure.functions
andazure.worker
. This is related to #118A few related issues:
The text was updated successfully, but these errors were encountered: