Skip to content

Commit 14cc396

Browse files
gavin-aguiarGavin AguiarAzureFunctionsPython
authored
Importing azure functions in InitRequest by default (#1250)
* Revert "Added worker to pythonpath (#1215)" This reverts commit a60ef25. * Update Python SDK Version to 1.14.1b3 (#1232) * Update Python SDK Version to 1.14.1b3 * Update setup.py --------- Co-authored-by: AzureFunctionsPython <[email protected]> * Update Python Worker Version to 4.13.0 * Update Python Worker Version to 4.14.0 * Importing azure functions in InitRequest by default * Updated tests --------- Co-authored-by: Gavin Aguiar <gavin@GavinPC> Co-authored-by: AzureFunctionsPython <[email protected]>
1 parent f9bf8ff commit 14cc396

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

azure_functions_worker/constants.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
"""
3131
UNIX_SHARED_MEMORY_DIRECTORIES = "FUNCTIONS_UNIX_SHARED_MEMORY_DIRECTORIES"
3232

33-
# Flag to enable loading functions at init request
34-
PYTHON_LOAD_FUNCTIONS_INIT = "PYTHON_LOAD_FUNCTIONS_INIT"
35-
3633
# Setting Defaults
3734
PYTHON_THREADPOOL_THREAD_COUNT_DEFAULT = 1
3835
PYTHON_THREADPOOL_THREAD_COUNT_MIN = 1

azure_functions_worker/dispatcher.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
PYTHON_THREADPOOL_THREAD_COUNT_MAX_37,
2727
PYTHON_THREADPOOL_THREAD_COUNT_MIN,
2828
PYTHON_ENABLE_DEBUG_LOGGING, SCRIPT_FILE_NAME,
29-
PYTHON_LANGUAGE_RUNTIME, PYTHON_LOAD_FUNCTIONS_INIT)
29+
PYTHON_LANGUAGE_RUNTIME)
3030
from .extension import ExtensionManager
3131
from .logging import disable_console_logging, enable_console_logging
3232
from .logging import enable_debug_logging_recommendation
@@ -288,10 +288,9 @@ async def _handle__worker_init_request(self, request):
288288
if not DependencyManager.is_in_linux_consumption():
289289
DependencyManager.prioritize_customer_dependencies()
290290

291-
if DependencyManager.is_in_linux_consumption() \
292-
and is_envvar_true(PYTHON_LOAD_FUNCTIONS_INIT):
291+
if DependencyManager.is_in_linux_consumption():
293292
logger.info(
294-
"PYTHON_LOAD_FUNCTIONS_INIT enabled. Importing azure functions")
293+
"Importing azure functions in WorkerInitRequest")
295294
import azure.functions # NoQA
296295

297296
# loading bindings registry and saving results to a static
@@ -539,12 +538,6 @@ async def _handle__function_environment_reload_request(self, request):
539538
func_env_reload_request = \
540539
request.function_environment_reload_request
541540

542-
if not is_envvar_true(PYTHON_LOAD_FUNCTIONS_INIT):
543-
# Import before clearing path cache so that the default
544-
# azure.functions modules is available in sys.modules for
545-
# customer use
546-
import azure.functions # NoQA
547-
548541
# Append function project root to module finding sys.path
549542
if func_env_reload_request.function_app_directory:
550543
sys.path.append(func_env_reload_request.function_app_directory)

tests/unittests/test_dispatcher.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,6 @@ async def test_dispatcher_load_azfunc_in_init(self):
632632
"""Test if the dispatcher's log can be flushed out during worker
633633
initialization
634634
"""
635-
os.environ.update({"CONTAINER_NAME": 'test',
636-
"PYTHON_LOAD_FUNCTIONS_INIT": "1"})
637635
async with self._ctrl as host:
638636
r = await host.init_worker('4.15.1')
639637
self.assertEqual(

0 commit comments

Comments
 (0)