diff --git a/src/ApiService/ApiService/Functions/AgentCanSchedule.cs b/src/ApiService/ApiService/Functions/AgentCanSchedule.cs index ac60b39c2..4f8087ff9 100644 --- a/src/ApiService/ApiService/Functions/AgentCanSchedule.cs +++ b/src/ApiService/ApiService/Functions/AgentCanSchedule.cs @@ -23,6 +23,7 @@ public class AgentCanSchedule { private async Async.Task Post(HttpRequestData req) { var request = await RequestHandling.ParseRequest(req); if (!request.IsOk) { + _log.Warning($"Cannot schedule due to {request.ErrorV}"); return await _context.RequestHandling.NotOk(req, request.ErrorV, typeof(CanScheduleRequest).ToString()); } @@ -30,6 +31,7 @@ public class AgentCanSchedule { var node = await _context.NodeOperations.GetByMachineId(canScheduleRequest.MachineId); if (node == null) { + _log.Warning($"Unable to find node {canScheduleRequest.MachineId}"); return await _context.RequestHandling.NotOk( req, new Error( @@ -50,11 +52,16 @@ public class AgentCanSchedule { var workStopped = task == null || task.State.ShuttingDown(); if (workStopped) { + _log.Info($"Work stopped {canScheduleRequest.MachineId}"); allowed = false; } if (allowed) { - allowed = (await _context.NodeOperations.AcquireScaleInProtection(node)).IsOk; + var scp = await _context.NodeOperations.AcquireScaleInProtection(node); + if (!scp.IsOk) { + _log.Warning($"Failed to acquire scale in protection due to {scp.ErrorV}"); + } + allowed = scp.IsOk; } return await RequestHandling.Ok(req, new CanSchedule(Allowed: allowed, WorkStopped: workStopped)); diff --git a/src/ApiService/ApiService/onefuzzlib/ScalesetOperations.cs b/src/ApiService/ApiService/onefuzzlib/ScalesetOperations.cs index 2f2fe602f..21cb616d1 100644 --- a/src/ApiService/ApiService/onefuzzlib/ScalesetOperations.cs +++ b/src/ApiService/ApiService/onefuzzlib/ScalesetOperations.cs @@ -142,7 +142,7 @@ public class ScalesetOperations : StatefulOrm SetFailed(Scaleset scaleset, Error error) { diff --git a/src/ApiService/ApiService/onefuzzlib/Scheduler.cs b/src/ApiService/ApiService/onefuzzlib/Scheduler.cs index b8f061314..fe651a9c9 100644 --- a/src/ApiService/ApiService/onefuzzlib/Scheduler.cs +++ b/src/ApiService/ApiService/onefuzzlib/Scheduler.cs @@ -53,7 +53,7 @@ public class Scheduler : IScheduler { var notReadyCount = tasks.Count - seen.Count; if (notReadyCount > 0) { - _logTracer.Info($"tasks not ready {notReadyCount}"); + _logTracer.Info($"tasks not ready {notReadyCount}. Tasks seen: {seen.Count}"); } }