Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
331 stars 100 forks source link

Reload modules when not in placeholder mode #1340

Closed gavin-aguiar closed 8 months ago

gavin-aguiar commented 8 months ago

Description

In linux consumption, when the host restarts the python worker due to any reason (timeout/OOM..), the host does not send an EnvironmentReload request since it assumes that the container has already been specialized. Due to this customer modules are not loaded and that causes the function app to fail with ModuleNotFound errors. Fix here is to load customer modules when the container is not in placeholder mode for linux consumption.

Fixes #1350


PR information

Quality of Code and Contribution Guidelines

codecov[bot] commented 8 months ago

Codecov Report

Merging #1340 (5683d3e) into dev (1a21fa5) will decrease coverage by 53.79%. The diff coverage is 71.42%.

:exclamation: Current head 5683d3e differs from pull request most recent head 4a59541. Consider uploading reports for the commit 4a59541 to get more accurate results

@@             Coverage Diff             @@
##              dev    #1340       +/-   ##
===========================================
- Coverage   85.96%   32.18%   -53.79%     
===========================================
  Files          34       34               
  Lines        1938     1942        +4     
  Branches      366      366               
===========================================
- Hits         1666      625     -1041     
- Misses        205     1316     +1111     
+ Partials       67        1       -66     
Flag Coverage Δ
unittests 32.18% <71.42%> (-53.73%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
azure_functions_worker/logging.py 34.61% <100.00%> (-10.49%) :arrow_down:
azure_functions_worker/dispatcher.py 19.04% <0.00%> (-68.68%) :arrow_down:
azure_functions_worker/utils/dependency.py 33.82% <75.00%> (-55.66%) :arrow_down:

... and 21 files with indirect coverage changes