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
9 changes: 9 additions & 0 deletions src/WebJobs.Script/Environment/EnvironmentExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,15 @@ public static bool IsLogicApp(this IEnvironment environment)
return !string.IsNullOrEmpty(appKind) && appKind.Contains(ScriptConstants.WorkFlowAppKind);
}

/// <summary>
/// Gets if codeful mode is enabled for Logic App app kind.
/// </summary>
public static bool IsLogicAppCodefulModeEnabled(this IEnvironment environment)
{
bool.TryParse(environment.GetEnvironmentVariable(EnvironmentSettingNames.LogicAppCodefulModeEnabled), out bool logicAppCodefulModeEnabled);
return logicAppCodefulModeEnabled;
}

/// <summary>
/// Gets if runtime environment needs multi language.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions src/WebJobs.Script/Environment/EnvironmentSettingNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ public static class EnvironmentSettingNames

public const string AppKind = "APP_KIND";

public const string LogicAppCodefulModeEnabled = "WORKFLOW_CODEFUL_ENABLED";

public const string DrainOnApplicationStopping = "FUNCTIONS_ENABLE_DRAIN_ON_APP_STOPPING";
}
}
2 changes: 1 addition & 1 deletion src/WebJobs.Script/Host/ScriptHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ internal async Task<Collection<FunctionDescriptor>> GetFunctionDescriptorsAsync(
Collection<FunctionDescriptor> functionDescriptors = new Collection<FunctionDescriptor>();
if (!cancellationToken.IsCancellationRequested)
{
bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = true;
bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = !(_environment.IsLogicApp() && _environment.IsLogicAppCodefulModeEnabled());
// this dotnet isolated specific logic is temporary to ensure in-proc payload compatibility with "dotnet-isolated" as the FUNCTIONS_WORKER_RUNTIME value.
if (string.Equals(workerRuntime, RpcWorkerConstants.DotNetIsolatedLanguageWorkerName, StringComparison.OrdinalIgnoreCase))
{
Expand Down
3 changes: 2 additions & 1 deletion src/WebJobs.Script/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,8 @@ public static void ValidateRetryOptions(RetryOptions
// WORKER_INDEXING_DISABLED contains the customers app name worker indexing is then disabled for that customer only
public static bool CanWorkerIndex(IEnumerable<RpcWorkerConfig> workerConfigs, IEnvironment environment, FunctionsHostingConfigOptions functionsHostingConfigOptions)
{
if (environment.IsLogicApp())
// NOTE: Enabling the worker indexing for Logic Apps with codeful mode enabled.
if (environment.IsLogicApp() && !environment.IsLogicAppCodefulModeEnabled())
Copy link
Member

Choose a reason for hiding this comment

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

@apranaseth Lets sync up offline on this. Would love to know more about the end to end testing and scenarios supported by this flag.

{
return false;
}
Expand Down
25 changes: 25 additions & 0 deletions test/WebJobs.Script.Tests/UtilityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,31 @@ public void WorkerIndexingDecisionLogic_NullConfig(bool workerIndexingFeatureFla
Assert.Equal(expected, workerShouldIndex);
}

[Theory]
[InlineData(true, true, true)]
[InlineData(true, false, false)]
public void WorkerIndexingDecisionLogic_LogicApps(bool workerIndexingFeatureFlag, bool enableIndexingForCodeful, bool expected)
{
var testEnv = new TestEnvironment();
testEnv.SetEnvironmentVariable(EnvironmentSettingNames.FunctionWorkerRuntime, RpcWorkerConstants.DotNetExecutableName);
testEnv.SetEnvironmentVariable(EnvironmentSettingNames.AppKind, ScriptConstants.WorkFlowAppKind);

if (workerIndexingFeatureFlag)
{
testEnv.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebJobsFeatureFlags, ScriptConstants.FeatureFlagEnableWorkerIndexing);
}

if (enableIndexingForCodeful)
{
testEnv.SetEnvironmentVariable(EnvironmentSettingNames.LogicAppCodefulModeEnabled, "true");
}

RpcWorkerConfig workerConfig = new RpcWorkerConfig() { Description = TestHelpers.GetTestWorkerDescription("dotnet", "none", true) };

bool workerShouldIndex = Utility.CanWorkerIndex(new List<RpcWorkerConfig>() { workerConfig }, testEnv, new FunctionsHostingConfigOptions());
Assert.Equal(expected, workerShouldIndex);
}

[Theory]
[InlineData(true, false)]
[InlineData(false, false)]
Expand Down