Ensure MaxTasksPerComputeNode is at least 2 when creating a single VM pool to prevent starvation.

This commit is contained in:
Christian Smith 2017-04-29 14:23:48 +10:00
Родитель 6943ac1c58
Коммит 56c73afa1f
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Web.Http;
using Microsoft.Azure.Batch;
@ -41,7 +42,11 @@ namespace Microsoft.Azure.Blast.Web.Controllers.Api
poolSpec.VirtualMachineSize,
_configuration.GetVirtualMachineConfiguration(),
poolSpec.TargetDedicated);
pool.MaxTasksPerComputeNode = _configuration.GetCoresForVirtualMachineSize(poolSpec.VirtualMachineSize);
// Need to always ensure a JM can run
pool.MaxTasksPerComputeNode = Math.Max(2,
_configuration.GetCoresForVirtualMachineSize(poolSpec.VirtualMachineSize));
pool.Commit();
}