Skip to content

Implement changes needed in the Host to decouple workers from the Host release #11111

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

Draft
wants to merge 69 commits into
base: feature/decouple-workers
Choose a base branch
from

Conversation

surgupta-msft
Copy link
Contributor

@surgupta-msft surgupta-msft commented Jun 9, 2025

Issue describing the changes in this PR

Related issue #10944

Update

As the PR now deals with multiple functionalities, splitting these changes into two separate PRs as described below. Additionally, converting this PR to a draft in case it’s needed for reference. I’ll close it when it’s no longer required.

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Additional PR information

This pull request introduces changes to decouple language workers from the Host release and enable dynamic worker resolution. Key updates include new worker configuration resolvers, environment enhancements, and feature flags to control worker behavior.

Backlog issues - Link
Design doc - Link

Flows covered in this PR -

  1. RPCWorkerConfigFactory -
    • Calls GetWorkerConfigs() method of IWorkerConfigurationResolver to get the required worker configs.
    • Moved some methods to WorkerConfigurationHelper.cs to enable reusing of workers profile evaluation logic.
  2. Resolving Worker Configurations -
    • Added DefaultWorkerConfigurationResolver to scan the Host's "workers" directory for worker configurations.
    • Introduced DynamicWorkerConfigurationResolver, which dynamically resolves worker configurations based on -
      • Environment settings and probing paths
      • Host-Worker compatibility check
      • Leveraging Release channel concept to point to a previous version of the worker
      • Fallback to the old flow if worker is not found at the probing path level
  3. Environment Updates -
    • Added IsWindowsEnvironment() to determine the windows environment type.
    • Added IsDynamicWorkerResolutionEnabled method to EnvironmentExtensions class to enable/disable dynamic worker resolution using feature flag and hosting configuration.
    • Added a new feature flag FeatureFlagDisableWorkerProbingPaths to disable dynamic resolution feature by users.
  4. WorkerConfigurationResolverOptionsSetup -
    • Configures WorkerConfigurationResolverOptions by getting required values from IConfiguration and IEnvironment such as worker probing paths, release channel, workers available for resolution via hosting config.

Note: The decoupling workers flow is disabled by default in this PR. We will enable the flow using Hosting Config after completing other relevant backlog items which will be included in follow-up PRs.

@surgupta-msft surgupta-msft requested a review from a team as a code owner June 9, 2025 19:38
@@ -144,30 +176,16 @@ internal void AddProvider(string workerDir)

_logger.LogDebug("Found worker config: {workerConfigPath}", workerConfigPath);

var workerConfig = GetWorkerConfigJsonElement(workerConfigPath);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No change in logic for this line. Just moved the method GetWorkerConfigJsonElement() to class WorkerConfigurationHelper

@@ -144,30 +176,16 @@ internal void AddProvider(string workerDir)

_logger.LogDebug("Found worker config: {workerConfigPath}", workerConfigPath);

var workerConfig = GetWorkerConfigJsonElement(workerConfigPath);
var workerDescriptionElement = workerConfig.GetProperty(WorkerConstants.WorkerDescription);
Copy link
Contributor Author

@surgupta-msft surgupta-msft Jun 9, 2025

Choose a reason for hiding this comment

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

All these lines (148-170) are moved to a method WorkerConfigurationHelper.GetWorkerDescription() - https://gist.github.com/surgupta-msft/612906e464e445284eb8400a2695c087/revisions

@@ -213,61 +231,6 @@ internal void AddProvider(string workerDir)
}
}

private static JsonElement GetWorkerConfigJsonElement(string workerConfigPath)
Copy link
Contributor Author

@surgupta-msft surgupta-msft Jun 9, 2025

Choose a reason for hiding this comment

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

These methods are also moved to class WorkerConfigurationHelper as we will need to call these methods from class WorkerConfigurationResolver as part of compatibility check

namespace Microsoft.Azure.WebJobs.Script.Workers.Rpc.Configuration
{
internal static class WorkerConfigurationHelper
{
Copy link
Contributor Author

@surgupta-msft surgupta-msft Jun 9, 2025

Choose a reason for hiding this comment

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

All the methods in this class are taken from RPCWorkerConfigFactory with minor adjustments. See gist - https://gist.github.com/surgupta-msft/fcecd60a676f9d7d73792c3a3dca9aa9/revisions

@surgupta-msft surgupta-msft changed the base branch from dev to surgupta/decouple-workers-feature June 11, 2025 05:39
@liliankasem
Copy link
Member

Minor comment on branch name, we should use feature/ for feature branches as we have rules and CI setup for it (its protected) i.e. feature/decouple-workers

@surgupta-msft surgupta-msft changed the base branch from surgupta/decouple-workers-feature to feature/decouple-workers July 8, 2025 01:16
Copy link
Member

@kshyju kshyju left a comment

Choose a reason for hiding this comment

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

Let's also add the placeholder + specialization use case test to validate that flow.

@surgupta-msft
Copy link
Contributor Author

Let's also add the placeholder + specialization use case test to validate that flow.

Yes, this will definitely be included with Integration and E2E tests changes. I am currently working on it - #11140

@surgupta-msft surgupta-msft requested a review from kshyju July 29, 2025 15:25
@surgupta-msft surgupta-msft marked this pull request as draft August 1, 2025 19:04
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.

Implement changes needed in the Host to decouple workers from the Host release
6 participants