Skip to content

feat: V2 library worker #1667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 49 commits into
base: dev
Choose a base branch
from
Open

feat: V2 library worker #1667

wants to merge 49 commits into from

Conversation

hallvictoria
Copy link
Contributor

@hallvictoria hallvictoria commented Apr 15, 2025

Description

The library worker holds the main logic for responding to the host, indexing function apps, and executing functions.

Fixes #


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made and CI is passing.

Quality of Code and Contribution Guidelines



async def function_load_request(request):
logger.debug("V2 Library Worker: received WorkerLoadRequest")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a no-op for the V2 library worker, but this method still needs to be defined in order to work with the proxy worker.

function_id)
assert fi is not None
logger.info("Function name: %s, Function Type: %s",
fi.name,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the third and last new log added. We log the function name and type (async vs. sync). This information was previously logged, so we log it here as well to maintain comprehensive logging.

configure_opentelemetry(fi_context)

# Extensions are not supported
call_result = await execute_async(fi.func, args)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extensions are not supported in 3.13+

+ str(indexed_function_bindings_logs))
indexed_function_logs.append(function_log)

log_data = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This formats the log into a JSON that we can easily parse in Kusto. We log the app setting state here alone -- this ensures that the app settings that are logged are accurate.

import traceback

# Logging Prefixes
SDK_LOG_PREFIX = "azure.functions"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Todo: change log prefix?

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import asyncio
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactor: moved methods related to the loop & executing out from dispatcher.py

@@ -49,31 +47,7 @@ extends:
- stage: Build
jobs:
- template: /eng/templates/official/jobs/build-artifacts.yml@self
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There will be only unit tests for the library worker. E2E tests will remain in the proxy worker.

@hallvictoria hallvictoria changed the base branch from 1.x to dev May 1, 2025 19:09
@hallvictoria hallvictoria marked this pull request as ready for review May 1, 2025 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant