Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions eng/templates/official/jobs/ci-lc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ jobs:

strategy:
matrix:
Python39:
PYTHON_VERSION: '3.9'
Python310:
PYTHON_VERSION: '3.10'
Python311:
PYTHON_VERSION: '3.11'
Python312:
PYTHON_VERSION: '3.12'
Python313:
PYTHON_VERSION: '3.13'
Python314:
PYTHON_VERSION: '3.14'
steps:
- task: UsePythonVersion@0
inputs:
Expand Down
2 changes: 1 addition & 1 deletion runtimes/v1/azure_functions_runtime_v1/handle_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ async def function_environment_reload_request(request):
os.environ[var] = env_vars[var]

if is_envvar_true(PYTHON_ENABLE_DEBUG_LOGGING):
root_logger = logging.getLogger("azure.functions")
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)

# calling load_binding_registry again since the
Expand Down
2 changes: 1 addition & 1 deletion runtimes/v2/azure_functions_runtime/handle_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ async def function_environment_reload_request(request):
# TODO: Apply PYTHON_THREADPOOL_THREAD_COUNT

if is_envvar_true(PYTHON_ENABLE_DEBUG_LOGGING):
root_logger = logging.getLogger("azure.functions")
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)

# calling load_binding_registry again since the
Expand Down
11 changes: 1 addition & 10 deletions workers/tests/consumption_tests/test_linux_consumption.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,7 @@ def test_reload_variables_after_oom_error(self):

sleep(2)
logs = ctrl.get_container_logs()
self.assertRegex(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep this assert but change the regex so it works for all python versions? For example, both proxy and afw log "Finished prioritize_customer_dependencies" - we could check for this log instead

logs,
r"Applying prioritize_customer_dependencies: "
r"worker_dependencies_path: \/azure-functions-host\/"
r"workers\/python\/.*?\/LINUX\/X64,"
r" customer_dependencies_path: \/home\/site\/wwwroot\/"
r"\.python_packages\/lib\/site-packages, working_directory:"
r" \/home\/site\/wwwroot, Linux Consumption: True,"
r" Placeholder: False")

assert "Finished prioritize_customer_dependencies" in logs
self.assertNotIn("Failure Exception: ModuleNotFoundError",
logs)

Expand Down
55 changes: 47 additions & 8 deletions workers/tests/utils/testutils_lc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@
# Linux Consumption Testing Constants
_DOCKER_PATH = "DOCKER_PATH"
_DOCKER_DEFAULT_PATH = "docker"
_MESH_IMAGE_URL = "https://mcr.microsoft.com/v2/azure-functions/mesh/tags/list"
_MESH_IMAGE_REPO = "mcr.microsoft.com/azure-functions/mesh"
_OS_TYPE = "bookworm" if sys.version_info.minor < 14 else "noble"
_MESH_IMAGE_URL = (
f"https://mcr.microsoft.com/v2/azure-functions/{_OS_TYPE}/"
"flexconsumption/tags/list"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this also work for 3.14 in the future?

)
_MESH_IMAGE_REPO = f"mcr.microsoft.com/azure-functions/{_OS_TYPE}/flexconsumption"
_FUNC_GITHUB_ZIP = "https://github.com/Azure/azure-functions-python-library" \
"/archive/refs/heads/dev.zip"
_FUNC_FILE_NAME = "azure-functions-python-library-dev"
Expand Down Expand Up @@ -219,19 +223,44 @@ def spawn_container(self,
container according to the image name. Return the port of container.
"""
# Construct environment variables and start the docker container
worker_path = os.path.join(PROJECT_ROOT, 'azure_functions_worker')
worker_name = 'azure_functions_worker' \
if sys.version_info.minor < 13 else 'proxy_worker'

worker_path = os.path.join(PROJECT_ROOT, worker_name)
container_worker_path = (
f"/azure-functions-host/workers/python/{self._py_version}/"
f"LINUX/X64/{worker_name}"
)

# For Python 3.13+, also mount the runtime libraries
runtime_v2_path = None
runtime_v1_path = None
container_runtime_v2_path = None
container_runtime_v1_path = None

if sys.version_info.minor >= 13:
repo_root = os.path.dirname(PROJECT_ROOT)
runtime_v2_path = os.path.join(
repo_root, 'runtimes', 'v2', 'azure_functions_runtime'
)
runtime_v1_path = os.path.join(
repo_root, 'runtimes', 'v1', 'azure_functions_runtime_v1'
)
container_runtime_v2_path = (
f"/azure-functions-host/workers/python/{self._py_version}/"
"LINUX/X64/azure_functions_runtime"
)
container_runtime_v1_path = (
f"/azure-functions-host/workers/python/{self._py_version}/"
"LINUX/X64/azure_functions_runtime_v1"
)

# TODO: Mount library in docker container
# self._download_azure_functions()

# Download python extension base package
ext_folder = self._download_extensions()

container_worker_path = (
f"/azure-functions-host/workers/python/{self._py_version}/"
"LINUX/X64/azure_functions_worker"
)

base_ext_container_path = (
f"/azure-functions-host/workers/python/{self._py_version}/"
"LINUX/X64/azurefunctions/extensions/base"
Expand All @@ -255,6 +284,16 @@ def spawn_container(self,
run_cmd.extend(["-e", f"WEBSITE_SITE_NAME={self._uuid}"])
run_cmd.extend(["-e", "WEBSITE_SKU=Dynamic"])
run_cmd.extend(["-v", f'{worker_path}:{container_worker_path}'])

# Mount runtime libraries for Python 3.13+
if runtime_v2_path and runtime_v1_path:
run_cmd.extend([
"-v", f'{runtime_v2_path}:{container_runtime_v2_path}'
])
run_cmd.extend([
"-v", f'{runtime_v1_path}:{container_runtime_v1_path}'
])

run_cmd.extend(["-v",
f'{base_ext_local_path}:{base_ext_container_path}'])

Expand Down
Loading