diff --git a/azure_functions_worker/dispatcher.py b/azure_functions_worker/dispatcher.py index d05d1839..2d5543d2 100644 --- a/azure_functions_worker/dispatcher.py +++ b/azure_functions_worker/dispatcher.py @@ -290,6 +290,8 @@ async def _handle__worker_init_request(self, request): if DependencyManager.is_in_linux_consumption() \ and is_envvar_true(PYTHON_LOAD_FUNCTIONS_INIT): + logger.info( + "PYTHON_LOAD_FUNCTIONS_INIT enabled. Importing azure functions") import azure.functions # NoQA # loading bindings registry and saving results to a static diff --git a/azure_functions_worker/utils/dependency.py b/azure_functions_worker/utils/dependency.py index 08ac7da5..9a8d75bd 100644 --- a/azure_functions_worker/utils/dependency.py +++ b/azure_functions_worker/utils/dependency.py @@ -210,17 +210,17 @@ def reload_azure_google_namespace_from_worker_deps(cls): """ # Reload package namespaces for customer's libraries packages_to_reload = ['azure', 'google'] + packages_reloaded = [] for p in packages_to_reload: try: - logger.info('Reloading %s module', p) importlib.reload(sys.modules[p]) + packages_reloaded.append(p) except Exception as ex: - logger.info('Unable to reload %s: \n%s', p, ex) - logger.info('Reloaded %s module', p) + logger.warning('Unable to reload %s: \n%s', p, ex) + + logger.info(f'Reloaded modules: {",".join(packages_reloaded)}') # Reload azure.functions to give user package precedence - logger.info('Reloading azure.functions module at %s', - inspect.getfile(sys.modules['azure.functions'])) try: importlib.reload(sys.modules['azure.functions']) logger.info('Reloaded azure.functions module now at %s',