From 56c73afa1f3b482b8e1575a29ea16e13fe128604 Mon Sep 17 00:00:00 2001 From: Christian Smith Date: Sat, 29 Apr 2017 14:23:48 +1000 Subject: [PATCH] Ensure MaxTasksPerComputeNode is at least 2 when creating a single VM pool to prevent starvation. --- .../AzureBlast.Web/Controllers/Api/PoolsController.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/LifeSciences/AzureBlast/AzureBlast.Web/Controllers/Api/PoolsController.cs b/LifeSciences/AzureBlast/AzureBlast.Web/Controllers/Api/PoolsController.cs index b656181..a1f0d4c 100644 --- a/LifeSciences/AzureBlast/AzureBlast.Web/Controllers/Api/PoolsController.cs +++ b/LifeSciences/AzureBlast/AzureBlast.Web/Controllers/Api/PoolsController.cs @@ -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(); }