question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optimizing publish from the core-tools

See original GitHub issue

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

  1. Pull and run microsoft/azure-functions-python3.6:v2.0.11651-alpha
  2. Copy your python functions and requirements.txt to the running container
  3. In the container, create a venv for your project named worker_venv under /home/site/wwwroot
  4. Run pip install -r requirements.txt in the container
  5. Package up your functions and venv
  6. Copy package outside of container

Proposed Workflow

  1. Create a venv for the project named worker_env. Activate it.

  2. For packages in requirements.txt, determine if they are pure .py packages or c extensions with universal wheels available on PyPI. Install these packages to worker_env using pip.

  3. If requirements.txt contains c extension packages that do not have universal wheels on PyPI,

    • Pull and run microsoft/azure-functions-python3.6:v2.0.11651-alpha
    • Copy worker_env and requirements.txt to the running container under /home/site/wwwroot
    • Pip install the remaining packages
    • Copy worker_env outside the container
  4. Package 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 and azure.worker. This is related to https://github.com/Azure/azure-functions-python-worker/issues/118

A few related issues:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
priyaananthasankarcommented, May 24, 2018

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.

1reaction
elpranscommented, Jun 4, 2018

@ahmelsayed @asavaritayal I decided to build a standalone Python module to create Python app packages for Azure. It would take the requirements.txt and generate the correct app.zip:

azure-functions-python-packer -r requirements.txt --platform linux --python-version 36 --output app.zip

core-tools would then simply need to add the above call.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Develop, test, and publish Azure Functions by using Azure ...
Use the Azure Functions Core Tools to create and run functions on a development computer and ... Run and test functions locally; Publish...
Read more >
Publishing a .NET class library as a Function App
In fact, the Visual Studio experience will be optimized around class libraries, while the Functions portal will continue to use script files.
Read more >
C# Optimization and dotnet CLI vs csc - Stack Overflow
I am trying to squeeze every bit of performance out of my compile C# project. I am using "dotnet" CLI with .Net Core...
Read more >
How to Do Keyword Optimization for SEO (3 Steps) - Ahrefs
In this post, you'll learn how to optimize your new and existing content for any keyword. Contents. Step 1. Make sure you're optimizing...
Read more >
3 Content Optimization Tools to Better Plan, Produce, and ...
By Samantha Bonanno | 5 min read | Published December 16, 2019 ... For content optimization, let's look at three core tools, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found