mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-10 01:01:34 +00:00
Bug fixes to enable timer_workers running properly (#2343)
Co-authored-by: stas <statis@microsoft.com>
This commit is contained in:
parent
e7abd2d8fa
commit
dd3aa1ce0a
@ -23,6 +23,7 @@ public class AgentCanSchedule {
|
||||
private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
|
||||
var request = await RequestHandling.ParseRequest<CanScheduleRequest>(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));
|
||||
|
@ -142,7 +142,7 @@ public class ScalesetOperations : StatefulOrm<Scaleset, ScalesetState, ScalesetO
|
||||
);
|
||||
}
|
||||
|
||||
return scaleset;
|
||||
return updatedScaleSet;
|
||||
}
|
||||
|
||||
async Async.Task<Scaleset> SetFailed(Scaleset scaleset, Error error) {
|
||||
|
@ -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}");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user