azure / azure-functions-docker-python-sample Goto Github PK
View Code? Open in Web Editor NEWA sample of using docker to deploy a Python based app
License: MIT License
A sample of using docker to deploy a Python based app
License: MIT License
Also not with the latest dockerfile image .
Also changed to new v2 format of host.json wo. success.
{
"version": "2.0",
"healthMonitor": {
"enabled": true,
"healthCheckInterval": "00:00:10",
"healthCheckWindow": "00:02:00",
"healthCheckThreshold": 6,
"counterThreshold": 0.80
},
"functionTimeout": "00:05:00",
"logging": {
"fileLoggingMode": "debugOnly"
},
"extensions": {
"http": {
"routePrefix": "api",
"maxConcurrentRequests": 5,
"maxOutstandingRequests": 30
},
"queues": {
"visibilityTimeout": "00:00:10"
},
"eventHubs": {
"batchCheckpointFrequency": 1,
"eventProcessorOptions": {
"maxBatchSize": 1000,
"prefetchCount": 1000
}
}
},
"swagger": {
"enabled": true
}
}
I've tried publishing this code 3 times to Functions and I haven't been able to hit the http trigger without getting a 404.
Are there any extra steps that should be taken other than what is in the README and the linked documentation?
It would be helpful to have dev branch with docker file consuming the latest version of worker and host.
There are important files that Microsoft projects should all have that are not present in this repository. A pull request has been opened to add the missing file(s). When the pr is merged this issue will be closed automatically.
Microsoft teams can learn more about this effort and share feedback within the open source guidance available internally.
I cloned and the example which targets base image: microsoft/azure-functions-python3.6:v2.0.11737-alpha
When I go to
I see an Http Error 406. In the docker logs I see that the HttpTrigger was hit.
info: Function.HttpTrigger[0]
=> System.Collections.Generic.Dictionary`2[System.String,System.Object] => System.Collections.Generic.Dictionary`2[System.String,System.Object]
Executing 'Functions.HttpTrigger' (Reason='This function was programmatically called via the host APIs.', Id=f7d69d25-233a-41da-a569-95a2bdaa9ca1)
For this sample, add notes on how to pass in the values for the connection strings for each of the triggers, i.e.,:
docker run -e AzureWebJobsStorage="<connection string>"
When trying to get the admin key from /api/functions/admin/masterkey they got an error that looks like the host wasn't generating the API keys. With the latest function core tools installation, this error can be reproduced. Simple HTTP Trigger.
Everything seems fine when I access my python app on this link:
http://funcmandag.azurewebsites.net/
However, when I curl this in terminal:
curl http://funcmandag.azurewebsites.net/api/HttpTriggerJS1?name=erlend
it returns nothing. When I paste it in the browser it gives me http error code 500.
Has anyone else experienced this?
The exact same thing happens locally:
http://localhost:8080/api/HttpTriggerJS1?name=erlend
This is from @priyaananthasankar
The latest Docker file that is updated with the alpha doesn’t work, it is unable to find workers path.
FROM microsoft/azure-functions-python3.6:v2.0.11651-alpha
ENV host:logger:consoleLoggingMode=always
COPY . /home/site/wwwroot
RUN cd /home/site/wwwroot && \
/bin/bash -c \
"source /workers/worker_env/bin/activate &&\
pip3 install -r requirements.txt"
The source /workers/worker_env/bin/activate isn’t working.
(functions_venv) IIQHost1:SyncWeek prananth$ python3.6 -m venv functions_venv
(functions_venv) IIQHost1:SyncWeek prananth$ mkdir python-functions
(functions_venv) IIQHost1:SyncWeek prananth$ ~/Downloads/Azure.Functions.Cli.osx-x64/func init . --worker-runtime python
Installing wheel package
Installing azure-functions (dev) package
Running pip freeze
Writing .gitignore
Writing host.json
Writing local.settings.json
Writing /Users/prananth/Projects/SyncWeek/.vscode/extensions.json
Initialized empty Git repository in /Users/prananth/Projects/SyncWeek/.git/
(functions_venv) IIQHost1:SyncWeek prananth$ ~/Downloads/Azure.Functions.Cli.osx-x64/func new
Select a language: Select a template:
Blob trigger
HTTP trigger
Queue trigger
Timer trigger
Choose option: 2
HTTP trigger
Function name: [HttpTriggerPython]
Writing /Users/prananth/Projects/SyncWeek/HttpTriggerPython/sample.dat
Writing /Users/prananth/Projects/SyncWeek/HttpTriggerPython/init.py
Writing /Users/prananth/Projects/SyncWeek/HttpTriggerPython/function.json
(functions_venv) IIQHost1:SyncWeek prananth$ ~/Downloads/Azure.Functions.Cli.osx-x64/func start
%%%%%%
%%%%%%
@ %%%%%% @
@@ %%%%%% @@
@@@ %%%%%%%%%%% @@@
@@ %%%%%%%%%% @@
@@ %%%% @@
@@ %%% @@
@@ %% @@
%%
%
Hosting environment: Production
Content root path: /Users/prananth/Projects/SyncWeek
Now listening on: http://localhost:7071
Application started. Press Ctrl+C to shut down.
[5/3/18 6:25:57 PM] Reading host configuration file '/Users/prananth/Projects/SyncWeek/host.json'
[5/3/18 6:25:57 PM] Host configuration file read:
[5/3/18 6:25:57 PM] {}
[5/3/18 6:25:57 PM] Starting Host (HostId=prananthsmacbookpro-1384342556, InstanceId=270e2f8b-8f5b-40f5-94b6-08c9c15acf6d, Version=2.0.11651.0, ProcessId=14684, AppDomainId=1, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=)
[5/3/18 6:25:57 PM] Unable to configure java worker. Could not find JAVA_HOME app setting.
[5/3/18 6:25:57 PM]
[5/3/18 6:25:57 PM] Could not configure language worker Java.
[5/3/18 6:25:57 PM]
[5/3/18 6:25:57 PM] Start Process: python "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py" --host 127.0.0.1 --port 62175 --workerId 1ac9c1ce-b563-4e27-8c5c-37d3045de668 --requestId 2f60cf63-a768-46ae-8870-a3bb80b9f644
[5/3/18 6:25:57 PM] Generating 1 job function(s)
[5/3/18 6:25:57 PM] Found the following functions:
[5/3/18 6:25:57 PM] Host.Functions.HttpTriggerPython
[5/3/18 6:25:57 PM]
[5/3/18 6:25:57 PM] Host initialized (684ms)
[5/3/18 6:25:57 PM] Traceback (most recent call last):
[5/3/18 6:25:57 PM] Traceback (most recent call last):
[5/3/18 6:25:57 PM] File "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py", line 33, in
[5/3/18 6:25:57 PM] File "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py", line 26, in main
[5/3/18 6:25:57 PM] main()
[5/3/18 6:25:57 PM] args.host, args.port, args.worker_id, args.request_id)
[5/3/18 6:25:57 PM] File "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py", line 26, in main
[5/3/18 6:25:57 PM] TypeError: start() missing 1 required positional argument: 'grpc_max_msg_len'
[5/3/18 6:25:57 PM] args.host, args.port, args.worker_id, args.request_id)
[5/3/18 6:25:57 PM] TypeError: start() missing 1 required positional argument: 'grpc_max_msg_len'
Listening on http://localhost:7071/
Hit CTRL-C to exit...
Http Functions:
HttpTriggerPython: http://localhost:7071/api/HttpTriggerPython
[5/3/18 6:25:58 PM] Worker encountered an error.
[5/3/18 6:25:58 PM] Worker process with pid 14685 exited with code 1.
[5/3/18 6:25:58 PM] Start Process: python "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py" --host 127.0.0.1 --port 62175 --workerId 27fce02a-6978-403c-99b8-502074b0f2f3 --requestId 799cdbf3-b31c-4f6e-bb36-ea843e678419
[5/3/18 6:25:58 PM] Traceback (most recent call last):
[5/3/18 6:25:58 PM] Traceback (most recent call last):
[5/3/18 6:25:58 PM] File "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py", line 26, in main
[5/3/18 6:25:58 PM] File "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py", line 33, in
[5/3/18 6:25:58 PM] args.host, args.port, args.worker_id, args.request_id)
[5/3/18 6:25:58 PM] main()
[5/3/18 6:25:58 PM] TypeError: start() missing 1 required positional argument: 'grpc_max_msg_len'
[5/3/18 6:25:58 PM] File "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py", line 26, in main
[5/3/18 6:25:58 PM] args.host, args.port, args.worker_id, args.request_id)
[5/3/18 6:25:58 PM] TypeError: start() missing 1 required positional argument: 'grpc_max_msg_len'
[5/3/18 6:25:58 PM] Worker encountered an error.
[5/3/18 6:25:58 PM] Worker process with pid 14686 exited with code 1.
[5/3/18 6:25:58 PM] Start Process: python "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py" --host 127.0.0.1 --port 62175 --workerId 806c9aa4-5390-4773-8770-de2bc3e4712c --requestId d131da20-8082-432a-870d-135938d2b448
[5/3/18 6:25:58 PM] Traceback (most recent call last):
[5/3/18 6:25:58 PM] Traceback (most recent call last):
[5/3/18 6:25:58 PM] File "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py", line 26, in main
[5/3/18 6:25:58 PM] File "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py", line 33, in
[5/3/18 6:25:58 PM] args.host, args.port, args.worker_id, args.request_id)
[5/3/18 6:25:58 PM] main()
[5/3/18 6:25:58 PM] TypeError: start() missing 1 required positional argument: 'grpc_max_msg_len'
[5/3/18 6:25:58 PM] File "/Users/prananth/Downloads/Azure.Functions.Cli.osx-x64/workers/python/worker.py", line 26, in main
[5/3/18 6:25:58 PM] args.host, args.port, args.worker_id, args.request_id)
[5/3/18 6:25:58 PM] TypeError: start() missing 1 required positional argument: 'grpc_max_msg_len'
[5/3/18 6:25:58 PM] Worker encountered an error.
[5/3/18 6:25:58 PM] Worker process with pid 14687 exited with code 1.
^CApplication is shutting down...
[5/3/18 6:26:06 PM] Host started (9318ms)
[5/3/18 6:26:06 PM] Job host started
[5/3/18 6:26:06 PM] Stopping Host
[5/3/18 6:26:06 PM] Job host stopped
Running with bash via Ubuntu 16.04 subsystem for Windows.
Followed instructions here: https://github.com/Azure/azure-functions-docker-python-sample/wiki/Getting-started-using-Functions-Core-Tools.
Downloaded linux zip file from https://ci.appveyor.com/project/appsvc/azure-functions-cli/build/2.0.1.294/artifacts
Upon using binaries to run func init . --worker-runtime python
(or any other call to func
), I get the following errors:
Failed to load X{z�, error: libunwind.so.8: cannot open shared object file: No such file or directory
Failed to bind to CoreCLR at '/mnt/c/Users/Administrator/dev/soh-local/func_venv_bash/linux_functions/libcoreclr.so'
Fixed by running apt-get install libunwind8
Should the Dockerfile 1st line read
FROM mcr.microsoft.com/azure-functions/python:2.0
I get a docker build error with the stated docker image
manifest for microsoft/azure-functions-python3.6:v2.0.11737-alpha not found
/usr/bin/docker failed with return code: 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.