Skip to content

Commit

Permalink
[Rpc]Rename SetWorkerCountToNumberOfCpuCores to SetProcessCountToNumb…
Browse files Browse the repository at this point in the history
…erOfCpuCores (Azure#6816)
  • Loading branch information
pragnagopa authored Oct 19, 2020
1 parent 6976eb5 commit af74036
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class WorkerProcessCountOptions
/// <summary>
/// Gets or sets a value indicating whether to set FUNCTIONS_WORKER_PROCESS_COUNT to number of cpu cores on the host machine
/// </summary>
public bool SetWorkerCountToNumberOfCpuCores { get; set; }
public bool SetProcessCountToNumberOfCpuCores { get; set; }

/// <summary>
/// Gets or sets number of worker processes to start. Default process count is 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ internal WorkerProcessCountOptions GetWorkerProcessCount(JObject workerConfig)

workerProcessCount = workerProcessCount ?? new WorkerProcessCountOptions();

if (workerProcessCount.SetWorkerCountToNumberOfCpuCores)
if (workerProcessCount.SetProcessCountToNumberOfCpuCores)
{
workerProcessCount.ProcessCount = _environment.GetEffectiveCoresCount();
// set Max worker process count to Number of effective cores if MaxProcessCount is less than MinProcessCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ public void ShouldAddProvider_Returns_Expected(string workerLanguage, string wor
[InlineData(false, false, false, 4, 15, "00:00:30")]
[InlineData(false, true, false, 4, 15, "00:00:30")]
[InlineData(false, true, true, 4, 8, "00:00:05")]
public void GetWorkerProcessCount_Tests(bool defaultWorkerConfig, bool setWorkerCountToNumberOfCpuCores, bool setWorkerCountInEnv, int minProcessCount, int maxProcessCount, string processStartupInterval)
public void GetWorkerProcessCount_Tests(bool defaultWorkerConfig, bool setProcessCountToNumberOfCpuCores, bool setWorkerCountInEnv, int minProcessCount, int maxProcessCount, string processStartupInterval)
{
JObject processCount = new JObject();
processCount["ProcessCount"] = minProcessCount;
processCount["MaxProcessCount"] = maxProcessCount;
processCount["ProcessStartupInterval"] = processStartupInterval;
processCount["SetWorkerCountToNumberOfCpuCores"] = setWorkerCountToNumberOfCpuCores;
processCount["SetProcessCountToNumberOfCpuCores"] = setProcessCountToNumberOfCpuCores;

JObject workerConfig = new JObject();
if (!defaultWorkerConfig)
Expand All @@ -199,7 +199,7 @@ public void GetWorkerProcessCount_Tests(bool defaultWorkerConfig, bool setWorker
Assert.Equal(10, result.MaxProcessCount);
Assert.Equal(1, result.ProcessCount);
Assert.Equal(TimeSpan.FromSeconds(10), result.ProcessStartupInterval);
Assert.False(result.SetWorkerCountToNumberOfCpuCores);
Assert.False(result.SetProcessCountToNumberOfCpuCores);
return;
}
if (setWorkerCountInEnv)
Expand All @@ -208,11 +208,11 @@ public void GetWorkerProcessCount_Tests(bool defaultWorkerConfig, bool setWorker
}
else
{
if (setWorkerCountInEnv && setWorkerCountToNumberOfCpuCores)
if (setWorkerCountInEnv && setProcessCountToNumberOfCpuCores)
{
Assert.Equal(7, result.ProcessCount);
}
else if (setWorkerCountToNumberOfCpuCores)
else if (setProcessCountToNumberOfCpuCores)
{
Assert.Equal(_testEnvironment.GetEffectiveCoresCount(), result.ProcessCount);
}
Expand All @@ -228,7 +228,7 @@ public void GetWorkerProcessCount_ThrowsException_Tests()
processCount["ProcessCount"] = -4;
processCount["MaxProcessCount"] = 10;
processCount["ProcessStartupInterval"] = "00:10:00";
processCount["SetWorkerCountToNumberOfCpuCores"] = false;
processCount["SetProcessCountToNumberOfCpuCores"] = false;

JObject workerConfig = new JObject();
workerConfig[WorkerConstants.ProcessCount] = processCount;
Expand Down

0 comments on commit af74036

Please sign in to comment.