mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-11 01:31:38 +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) {
|
private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
|
||||||
var request = await RequestHandling.ParseRequest<CanScheduleRequest>(req);
|
var request = await RequestHandling.ParseRequest<CanScheduleRequest>(req);
|
||||||
if (!request.IsOk) {
|
if (!request.IsOk) {
|
||||||
|
_log.Warning($"Cannot schedule due to {request.ErrorV}");
|
||||||
return await _context.RequestHandling.NotOk(req, request.ErrorV, typeof(CanScheduleRequest).ToString());
|
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);
|
var node = await _context.NodeOperations.GetByMachineId(canScheduleRequest.MachineId);
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
|
_log.Warning($"Unable to find node {canScheduleRequest.MachineId}");
|
||||||
return await _context.RequestHandling.NotOk(
|
return await _context.RequestHandling.NotOk(
|
||||||
req,
|
req,
|
||||||
new Error(
|
new Error(
|
||||||
@ -50,11 +52,16 @@ public class AgentCanSchedule {
|
|||||||
var workStopped = task == null || task.State.ShuttingDown();
|
var workStopped = task == null || task.State.ShuttingDown();
|
||||||
|
|
||||||
if (workStopped) {
|
if (workStopped) {
|
||||||
|
_log.Info($"Work stopped {canScheduleRequest.MachineId}");
|
||||||
allowed = false;
|
allowed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allowed) {
|
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));
|
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) {
|
async Async.Task<Scaleset> SetFailed(Scaleset scaleset, Error error) {
|
||||||
|
@ -53,7 +53,7 @@ public class Scheduler : IScheduler {
|
|||||||
|
|
||||||
var notReadyCount = tasks.Count - seen.Count;
|
var notReadyCount = tasks.Count - seen.Count;
|
||||||
if (notReadyCount > 0) {
|
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