From 8c98fed422209e7dccc0c9150614224e6cbacbef Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Fri, 14 Apr 2023 16:59:09 -0500 Subject: [PATCH 1/2] Added worker to pythonpath --- python/prodV4/worker.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/prodV4/worker.py b/python/prodV4/worker.py index b3c0faf01..14909929d 100644 --- a/python/prodV4/worker.py +++ b/python/prodV4/worker.py @@ -50,6 +50,8 @@ def determine_user_pkg_paths(): if __name__ == '__main__': # worker.py lives in the same directory as azure_functions_worker + current_dir = str(Path(__file__).absolute()) + worker_path = os.path.join(current_dir, "azure_functions_worker") func_worker_dir = str(Path(__file__).absolute().parent) env = os.environ @@ -57,7 +59,7 @@ def determine_user_pkg_paths(): # third-party user packages over worker packages in PYTHONPATH user_pkg_paths = determine_user_pkg_paths() joined_pkg_paths = os.pathsep.join(user_pkg_paths) - env['PYTHONPATH'] = f'{joined_pkg_paths}:{func_worker_dir}' + env['PYTHONPATH'] = f'{worker_path}:{joined_pkg_paths}:{func_worker_dir}' if is_azure_environment(): os.execve(sys.executable, From e5b33678cbbc89ec63750cb0c3fc9ff8f85e90b8 Mon Sep 17 00:00:00 2001 From: Gavin Aguiar Date: Mon, 17 Apr 2023 11:53:55 -0500 Subject: [PATCH 2/2] Added constant for azure functions worker --- python/prodV4/worker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/prodV4/worker.py b/python/prodV4/worker.py index 14909929d..609d02bcc 100644 --- a/python/prodV4/worker.py +++ b/python/prodV4/worker.py @@ -6,6 +6,7 @@ # User packages PKGS_PATH = "site/wwwroot/.python_packages" VENV_PKGS_PATH = "site/wwwroot/worker_venv" +WORKER_DIR = "azure_functions_worker" PKGS = "lib/site-packages" @@ -51,7 +52,7 @@ def determine_user_pkg_paths(): if __name__ == '__main__': # worker.py lives in the same directory as azure_functions_worker current_dir = str(Path(__file__).absolute()) - worker_path = os.path.join(current_dir, "azure_functions_worker") + worker_path = os.path.join(current_dir, WORKER_DIR) func_worker_dir = str(Path(__file__).absolute().parent) env = os.environ @@ -63,7 +64,7 @@ def determine_user_pkg_paths(): if is_azure_environment(): os.execve(sys.executable, - [sys.executable, '-m', 'azure_functions_worker'] + [sys.executable, '-m', WORKER_DIR] + sys.argv[1:], env) else: