diff --git a/azure_functions_worker/constants.py b/azure_functions_worker/constants.py index 27380bd9..44e7461f 100644 --- a/azure_functions_worker/constants.py +++ b/azure_functions_worker/constants.py @@ -30,9 +30,6 @@ data transfer between host and worker. """ UNIX_SHARED_MEMORY_DIRECTORIES = "FUNCTIONS_UNIX_SHARED_MEMORY_DIRECTORIES" -# Flag to enable loading functions at init request -PYTHON_LOAD_FUNCTIONS_INIT = "PYTHON_LOAD_FUNCTIONS_INIT" - # Setting Defaults PYTHON_THREADPOOL_THREAD_COUNT_DEFAULT = 1 PYTHON_THREADPOOL_THREAD_COUNT_MIN = 1 diff --git a/azure_functions_worker/dispatcher.py b/azure_functions_worker/dispatcher.py index 485d5ed1..988f2686 100644 --- a/azure_functions_worker/dispatcher.py +++ b/azure_functions_worker/dispatcher.py @@ -26,7 +26,7 @@ from .constants import (PYTHON_THREADPOOL_THREAD_COUNT, PYTHON_THREADPOOL_THREAD_COUNT_MAX_37, PYTHON_THREADPOOL_THREAD_COUNT_MIN, PYTHON_ENABLE_DEBUG_LOGGING, SCRIPT_FILE_NAME, - PYTHON_LANGUAGE_RUNTIME, PYTHON_LOAD_FUNCTIONS_INIT) + PYTHON_LANGUAGE_RUNTIME) from .extension import ExtensionManager from .logging import disable_console_logging, enable_console_logging from .logging import enable_debug_logging_recommendation @@ -288,10 +288,9 @@ class Dispatcher(metaclass=DispatcherMeta): if not DependencyManager.is_in_linux_consumption(): DependencyManager.prioritize_customer_dependencies() - if DependencyManager.is_in_linux_consumption() \ - and is_envvar_true(PYTHON_LOAD_FUNCTIONS_INIT): + if DependencyManager.is_in_linux_consumption(): logger.info( - "PYTHON_LOAD_FUNCTIONS_INIT enabled. Importing azure functions") + "Importing azure functions in WorkerInitRequest") import azure.functions # NoQA # loading bindings registry and saving results to a static @@ -539,12 +538,6 @@ class Dispatcher(metaclass=DispatcherMeta): func_env_reload_request = \ request.function_environment_reload_request - if not is_envvar_true(PYTHON_LOAD_FUNCTIONS_INIT): - # Import before clearing path cache so that the default - # azure.functions modules is available in sys.modules for - # customer use - import azure.functions # NoQA - # Append function project root to module finding sys.path if func_env_reload_request.function_app_directory: sys.path.append(func_env_reload_request.function_app_directory) diff --git a/tests/unittests/test_dispatcher.py b/tests/unittests/test_dispatcher.py index 472f8e21..dfdcb56d 100644 --- a/tests/unittests/test_dispatcher.py +++ b/tests/unittests/test_dispatcher.py @@ -632,8 +632,6 @@ class TestDispatcherLoadFunctionInInitRequest(testutils.AsyncTestCase): """Test if the dispatcher's log can be flushed out during worker initialization """ - os.environ.update({"CONTAINER_NAME": 'test', - "PYTHON_LOAD_FUNCTIONS_INIT": "1"}) async with self._ctrl as host: r = await host.init_worker('4.15.1') self.assertEqual(